summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2018-04-02 21:30:51 +0200
committerByteHamster <info@bytehamster.com>2018-04-02 21:30:51 +0200
commitbde6e316fcdfe0d78cb17585a62d7aae70e371ab (patch)
tree7c2c6be6260e3224e287c17646b58c2437f824a3 /app
parentfdc5b43ab70f226f9463a84f79ae260af08cb376 (diff)
downloadAntennaPod-bde6e316fcdfe0d78cb17585a62d7aae70e371ab.zip
Clarified test cases
Diffstat (limited to 'app')
-rw-r--r--app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java52
1 files changed, 27 insertions, 25 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
index c991ccd39..db463132d 100644
--- a/app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/feed/FeedItemTest.java
@@ -4,32 +4,34 @@ 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);
+ }
- public void testShownoteLength() throws Exception {
- FeedItem item = new FeedItem();
-
- item.setDescription(null);
- item.setContentEncoded("Hello world");
- assertEquals("Hello world", item.loadShownotes().call());
-
- item.setDescription("");
- item.setContentEncoded("Hello world");
- assertEquals("Hello world", item.loadShownotes().call());
-
- item.setDescription("Hello world");
- item.setContentEncoded(null);
- assertEquals("Hello world", item.loadShownotes().call());
-
- item.setDescription("Hello world");
- item.setContentEncoded("");
- assertEquals("Hello world", item.loadShownotes().call());
-
- item.setDescription("Hi");
- item.setContentEncoded("Hello world");
- assertEquals("Hello world", item.loadShownotes().call());
+ /**
+ * 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);
+ }
- item.setDescription("Hello world");
- item.setContentEncoded("Hi");
- assertEquals("Hello world", item.loadShownotes().call());
+ /**
+ * 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());
}
}