Added pubDate test

This commit is contained in:
ByteHamster 2019-11-15 15:41:26 +01:00
parent 5f7a11a865
commit 3c6540b82e
1 changed files with 13 additions and 0 deletions

View File

@ -3,6 +3,9 @@ package de.danoeh.antennapod.core.feed;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.text.SimpleDateFormat;
import java.util.Date;
import static de.danoeh.antennapod.core.feed.FeedItemMother.anyFeedItemWithImage; import static de.danoeh.antennapod.core.feed.FeedItemMother.anyFeedItemWithImage;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
@ -40,6 +43,16 @@ public class FeedItemTest {
assertFeedItemImageWasUpdated(); assertFeedItemImageWasUpdated();
} }
@Test
public void testUpdateFromOther_dateChanged() throws Exception {
Date originalDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("1952-03-11 00:00:00");
Date changedDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("1952-03-11 00:42:42");
original.setPubDate(originalDate);
changedFeedItem.setPubDate(changedDate);
original.updateFromOther(changedFeedItem);
assertEquals(changedDate.getTime(), original.getPubDate().getTime());
}
/** /**
* Test that a played item loses that state after being marked as new. * Test that a played item loses that state after being marked as new.
*/ */