1 26 27 29 package de.nava.informa.parsers; 30 31 import java.io.File ; 32 import java.io.IOException ; 33 import java.net.URL ; 34 import java.util.Collection ; 35 import java.util.Iterator ; 36 37 import de.nava.informa.core.FeedIF; 38 import de.nava.informa.core.ParseException; 39 import de.nava.informa.utils.InformaTestCase; 40 41 public class TestOPML_1_1_Parser extends InformaTestCase { 42 43 static Collection feeds; 44 static URL inpURL; 45 46 public TestOPML_1_1_Parser(String name) 47 throws IOException , ParseException { 48 49 super("TestOPML_1_1_Parser", name); 50 if (feeds == null) { 51 File inpFile = new File (getDataDir(), "favchannels.opml"); 52 feeds = OPMLParser.parse(inpFile); 53 inpURL = inpFile.toURL(); 55 } 56 } 57 58 public void testNumberFeedsReadIn() { 59 assertEquals(25, feeds.size()); 60 } 61 62 public void testReadInFeeds() { 63 Iterator it = feeds.iterator(); 64 boolean found = false; 65 while (it.hasNext()) { 66 FeedIF feed = (FeedIF) it.next(); 67 if (feed.getTitle().startsWith("Debian Planet")) { 68 assertEquals("Debian Planet", feed.getTitle()); 69 assertEquals("rss", feed.getContentType()); 70 assertEquals("http://www.debianplanet.org/module.php?mod=node&op=feed", 71 feed.getLocation().toString()); 72 assertEquals("http://www.debianplanet.org/", 73 feed.getSite().toString()); 74 found = true; 75 break; 76 } 77 } 78 assertTrue("Couldn't find item looked for.", found); 79 } 80 81 } 82 | Popular Tags |