mirror of
https://github.com/AntennaPod/AntennaPod.git
synced 2024-12-22 06:22:00 +01:00
Test to ensure Feed only accepts INTRA_FEED sort order
This commit is contained in:
parent
bcd4b49dda
commit
9c895ef15a
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user