summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorMartin Fietz <Martin.Fietz@gmail.com>2018-04-03 21:59:02 +0200
committerGitHub <noreply@github.com>2018-04-03 21:59:02 +0200
commit43f450433eb91a698fcb2a9214cd4b3df2ca7d2e (patch)
tree98c58799becc1d374a62ebb57909103526e819d5 /app
parentedcc7ac9c275506c107b57e871939c738f508f65 (diff)
parentbde6e316fcdfe0d78cb17585a62d7aae70e371ab (diff)
downloadAntennaPod-43f450433eb91a698fcb2a9214cd4b3df2ca7d2e.zip
Merge pull request #2607 from ByteHamster/content-encoded
Fixes empty contentEncoded
Diffstat (limited to 'app')
-rw-r--r--app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java b/app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java
new file mode 100644
index 000000000..db463132d
--- /dev/null
+++ b/app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java
@@ -0,0 +1,37 @@
+package de.test.antennapod.feed;
+
+import android.test.AndroidTestCase;
+import de.danoeh.antennapod.core.feed.FeedItem;
+
+public class FeedItemTest extends AndroidTestCase {
+ private static final String TEXT_LONG = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
+ private static final String TEXT_SHORT = "Lorem ipsum";
+
+ /**
+ * If one of `description` or `content:encoded` is null, use the other one.
+ */
+ public void testShownotesNullValues() throws Exception {
+ testShownotes(null, TEXT_LONG);
+ testShownotes(TEXT_LONG, null);
+ }
+
+ /**
+ * If `description` is reasonably longer than `content:encoded`, use `description`.
+ */
+ public void testShownotesLength() throws Exception {
+ testShownotes(TEXT_SHORT, TEXT_LONG);
+ testShownotes(TEXT_LONG, TEXT_SHORT);
+ }
+
+ /**
+ * Checks if the shownotes equal TEXT_LONG, using the given `description` and `content:encoded`
+ * @param description Description of the feed item
+ * @param contentEncoded `content:encoded` of the feed item
+ */
+ private void testShownotes(String description, String contentEncoded) throws Exception {
+ FeedItem item = new FeedItem();
+ item.setDescription(description);
+ item.setContentEncoded(contentEncoded);
+ assertEquals(TEXT_LONG, item.loadShownotes().call());
+ }
+}