@Before public void setup() throws Exception { File file; file = new File("src/test/resources/org/wooddog/job/channel/rss-feed-2.0.xml"); channel = new Channel(); channel.setUrl(file.toURI().toURL()); channel.setType("RSS"); subject = new RssChannelFetcher(); }
@Test public void testMapping() throws Exception { List<Article> articleList; Article article; articleList = subject.fetch(channel, new Date(0)); Assert.assertEquals(false, articleList.isEmpty()); article = articleList.get(0); Assert.assertEquals("title", article.getTitle()); Assert.assertEquals("description", article.getDescription()); Assert.assertEquals("http://link", article.getLink()); Assert.assertEquals( new GregorianCalendar(2011, 7, 22, 8, 48, 0).getTime(), article.getPublished()); Assert.assertEquals(channel.getUrl().toURI().toURL().toExternalForm(), article.getSource()); }