}
try {
feed1 = feedDoc.readFeedToBean(badFeed6);
Entry ent = feed1.getEntry("Atom-Powered Robots Run Amok");
Extension ext = feedDoc.buildExtension("unbound:ele", null, null);
List<Extension> extns = new LinkedList<Extension>();
extns.add(ext);
ent = feedDoc.buildEntry(ent.getId(), ent.getTitle(), ent
.getUpdated(), ent.getRights(), ent.getContent(), ent
.getAuthors(), ent.getCategories(), ent.getContributors(),
ent.getLinks(), ent.getAttributes(), extns, ent
.getPublished(), ent.getSummary(), ent.getSource());
List<Entry> entries = feed1.getEntries();
for (int i = 0; i < entries.size(); i++) {
if (entries.get(i).getTitle().getText().equals(
"Atom-Powered Robots Run Amok")) {
entries.remove(i);
break;
}
}
entries.add(ent);
feedDoc.buildFeed(feed1.getId(), feed1.getTitle(), feed1
.getUpdated(), feed1.getRights(), feed1.getAuthors(), feed1
.getCategories(), feed1.getContributors(),
feed1.getLinks(), feed1.getAttributes(), feed1
.getExtensions(), feed1.getGenerator(), feed1
.getSubtitle(), feed1.getIcon(), feed1.getLogo(),
entries);
fail("should not get here.");
} catch (Exception e) {
assertTrue(e instanceof AtomSpecException);
assertEquals(
e.getMessage(),
"the following extension prefix(es) ( unbound ) are not bound to a namespace declaration. See http://www.w3.org/TR/1999/REC-xml-names-19990114/#ns-decl.");
}
try {
feed1 = feedDoc.readFeedToBean(badFeed6);
Entry ent = feed1.getEntry("Atom-Powered Robots Run Amok");
feedDoc.writeEntryDoc(new FileOutputStream(new File(
"target/works.xml")), ent, null, null);
Extension ext = feedDoc.buildExtension("unbound:ele", null, null);
List<Extension> extns = new LinkedList<Extension>();
extns.add(ext);
ent = feedDoc.buildEntry(ent.getId(), ent.getTitle(), ent
.getUpdated(), ent.getRights(), ent.getContent(), ent
.getAuthors(), ent.getCategories(), ent.getContributors(),