package de.danoeh.antennapod.core.feed;

import org.junit.Before;
import org.junit.Test;

import static de.danoeh.antennapod.core.feed.FeedItemMother.anyFeedItemWithImage;
import static org.junit.Assert.assertEquals;

public class FeedItemTest {

    private FeedItem original;
    private FeedItem changedFeedItem;

    @Before
    public void setUp() {
        original = anyFeedItemWithImage();
        changedFeedItem = anyFeedItemWithImage();
    }

    @Test
    public void testUpdateFromOther_feedItemImageDownloadUrlChanged() throws Exception {
        setNewFeedItemImageDownloadUrl();
        original.updateFromOther(changedFeedItem);
        assertFeedItemImageWasUpdated();
    }

    @Test
    public void testUpdateFromOther_feedItemImageRemoved() throws Exception {
        feedItemImageRemoved();
        original.updateFromOther(changedFeedItem);
        assertFeedItemImageWasNotUpdated();
    }

    @Test
    public void testUpdateFromOther_feedItemImageAdded() throws Exception {
        original.setImageUrl(null);
        setNewFeedItemImageDownloadUrl();
        original.updateFromOther(changedFeedItem);
        assertFeedItemImageWasUpdated();
    }

    private void setNewFeedItemImageDownloadUrl() {
        changedFeedItem.setImageUrl("http://example.com/new_picture");
    }

    private void feedItemImageRemoved() {
        changedFeedItem.setImageUrl(null);
    }

    private void assertFeedItemImageWasUpdated() {
        assertEquals(original.getImageUrl(), changedFeedItem.getImageUrl());
    }

    private void assertFeedItemImageWasNotUpdated() {
        assertEquals(anyFeedItemWithImage().getImageUrl(), original.getImageUrl());
    }

}
@@ -209,16 +209,60 @@
 tEquals;
+%0Aimport static org.junit.Assert.assertFalse;
 %0A%0Apublic
@@ -1209,32 +1209,566 @@
 dated();%0A    %7D%0A%0A
+    /**%0A     * Test that a played item loses that state after being marked as new.%0A     */%0A    @Test%0A    public void testMarkPlayedItemAsNew_itemNotPlayed() %7B%0A        original.setPlayed(true);%0A        original.setNew();%0A%0A        assertFalse(original.isPlayed());%0A    %7D%0A%0A    /**%0A     * Test that a new item loses that state after being marked as played.%0A     */%0A    @Test%0A    public void testMarkNewItemAsPlayed_itemNotNew() %7B%0A        original.setNew();%0A        original.setPlayed(true);%0A%0A        assertFalse(original.isNew());%0A    %7D%0A%0A
     private void

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