diff options
author | orionlee <orionlee@yahoo.com> | 2019-10-24 12:17:31 -0700 |
---|---|---|
committer | orionlee <orionlee@yahoo.com> | 2019-10-24 12:17:31 -0700 |
commit | 9c895ef15a19b840a227a605814f94d787e5b508 (patch) | |
tree | 39f94368143824c9169a5c31295d121f7bc44af0 | |
parent | bcd4b49dda0a75bb61396ee4c4ab5521c5dc0c26 (diff) | |
download | AntennaPod-9c895ef15a19b840a227a605814f94d787e5b508.zip |
Test to ensure Feed only accepts INTRA_FEED sort order
-rw-r--r-- | core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java index 4717041f4..88b342850 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java @@ -3,10 +3,13 @@ package de.danoeh.antennapod.core.feed; import org.junit.Before; import org.junit.Test; +import de.danoeh.antennapod.core.util.SortOrder; + import static de.danoeh.antennapod.core.feed.FeedMother.anyFeed; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; public class FeedTest { @@ -59,6 +62,27 @@ public class FeedTest { feedImageWasUpdated(); } + @Test + public void testSetSortOrder_OnlyIntraFeedSortAllowed() throws Exception { + for (SortOrder sortOrder : SortOrder.values()) { + if (sortOrder.scope == SortOrder.Scope.INTRA_FEED) { + original.setSortOrder(sortOrder); // should be okay + } else { + try { + original.setSortOrder(sortOrder); + fail("SortOrder " + sortOrder + " should not be allowed on a feed"); + } catch (IllegalArgumentException iae) { + // expected exception + } + } + } + } + + @Test + public void testSetSortOrder_NullAllowed() throws Exception { + original.setSortOrder(null); // should be okay + } + private void feedHasNotChanged() { assertFalse(original.compareWithOther(changedFeed)); } |