Validate that the *new* and *played* states are exclusive

This commit is contained in:
Borjan Tchakaloff 2019-03-31 16:01:41 +02:00
parent c6344f5bc0
commit 3c7fd274de
1 changed files with 23 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import org.junit.Test;
import static de.danoeh.antennapod.core.feed.FeedItemMother.anyFeedItemWithImage;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
public class FeedItemTest {
@ -39,6 +40,28 @@ public class FeedItemTest {
assertFeedItemImageWasUpdated();
}
/**
* Test that a played item loses that state after being marked as new.
*/
@Test
public void testMarkPlayedItemAsNew_itemNotPlayed() {
original.setPlayed(true);
original.setNew();
assertFalse(original.isPlayed());
}
/**
* Test that a new item loses that state after being marked as played.
*/
@Test
public void testMarkNewItemAsPlayed_itemNotNew() {
original.setNew();
original.setPlayed(true);
assertFalse(original.isNew());
}
private void setNewFeedItemImageDownloadUrl() {
changedFeedItem.setImageUrl("http://example.com/new_picture");
}