diff options
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/java/de/danoeh/antennapod/core/syndication/handler/AtomParserTest.java | 29 | ||||
-rw-r--r-- | core/src/test/resources/feed-atom-testEmptyRelLinks.xml | 14 |
2 files changed, 43 insertions, 0 deletions
diff --git a/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/AtomParserTest.java b/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/AtomParserTest.java index 2acc73204..36ca7f0d8 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/AtomParserTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/syndication/handler/AtomParserTest.java @@ -14,6 +14,7 @@ import de.danoeh.antennapod.model.feed.FeedMedia; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; /** * Tests for Atom feeds in FeedHandler. @@ -55,6 +56,34 @@ public class AtomParserTest { } @Test + public void testEmptyRelLinks() throws Exception { + File feedFile = FeedParserTestHelper.getFeedFile("feed-atom-testEmptyRelLinks.xml"); + Feed feed = FeedParserTestHelper.runFeedParser(feedFile); + assertEquals(Feed.TYPE_ATOM1, feed.getType()); + assertEquals("title", feed.getTitle()); + assertEquals("http://example.com/feed", feed.getFeedIdentifier()); + assertEquals("http://example.com", feed.getLink()); + assertEquals("This is the description", feed.getDescription()); + assertNull(feed.getPaymentLinks()); + assertEquals("http://example.com/picture", feed.getImageUrl()); + assertEquals(1, feed.getItems().size()); + + // feed entry + FeedItem item = feed.getItems().get(0); + assertEquals("http://example.com/item-0", item.getItemIdentifier()); + assertEquals("item-0", item.getTitle()); + assertNull(item.getDescription()); + assertEquals("http://example.com/items/0", item.getLink()); + assertEquals(new Date(0), item.getPubDate()); + assertNull(item.getPaymentLink()); + assertEquals("http://example.com/picture", item.getImageLocation()); + // media + assertFalse(item.hasMedia()); + // chapters + assertNull(item.getChapters()); + } + + @Test public void testLogoWithWhitespace() throws Exception { File feedFile = FeedParserTestHelper.getFeedFile("feed-atom-testLogoWithWhitespace.xml"); Feed feed = FeedParserTestHelper.runFeedParser(feedFile); diff --git a/core/src/test/resources/feed-atom-testEmptyRelLinks.xml b/core/src/test/resources/feed-atom-testEmptyRelLinks.xml new file mode 100644 index 000000000..04c28ef67 --- /dev/null +++ b/core/src/test/resources/feed-atom-testEmptyRelLinks.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + <id>http://example.com/feed</id> + <title>title</title> + <link href="http://example.com" /> + <subtitle>This is the description</subtitle> + <logo>http://example.com/picture</logo> + <entry> + <id>http://example.com/item-0</id> + <title>item-0</title> + <link href="http://example.com/items/0" /> + <published>1970-01-01T00:00:00Z</published> + </entry> +</feed> |