* test the feed doc constructors.
*/
@Test
public void testFeedDocTest() {
try {
RSSDoc rss2 = null;
List<RSSDoc.ProcessingInstruction> insts = new LinkedList<RSSDoc.ProcessingInstruction>();
insts.add(new RSSDoc().new ProcessingInstruction("xml-stylesheet",
"href=\"http://www.blogger.com/styles/atom.css\" type=\"text/css\""));
rss2 = new RSSDoc(insts);
rss2.setEncoding("ISO-8859-1");
System.out
.println("pi before: " + rss2.getProcessingInstructions());
assertNotNull(rss2);
String output = rss2
.readRSSToString(
rss2.readRSSToBean(new java.net.URL(
"http://omsa-uchicago.blogspot.com/feeds/posts/default?alt=rss")),
null);
assertTrue(output
.indexOf("<?xml-stylesheet href=\"http://www.blogger.com/styles/atom.css\" type=\"text/css\"?>") != -1);
// needed for running on windows
rss2.setEncoding("ISO-8859-1");
assertNotNull(rss2.readRSSToBean(output));
try {
rss2.readRSSToBean(badRSS);
fail("should not get here.");
} catch (Exception e) {
assertTrue(e instanceof RSSpectException);
assertEquals(e.getMessage(),
"rss documents must contain the version attribute.");