diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-03-23 18:06:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-23 18:06:02 +0100 |
commit | a065d3fc338371d1e5f0782bb99a847cc5a9ea93 (patch) | |
tree | f35c487317c9b7979c02f3839dfab77681bc6de1 /core/src/test/java/de/danoeh | |
parent | f6b45e7162ce3909cb2b04a4124e71aad22240c6 (diff) | |
download | AntennaPod-a065d3fc338371d1e5f0782bb99a847cc5a9ea93.zip |
Remove check for updated attributes, just update them (#7018)
Diffstat (limited to 'core/src/test/java/de/danoeh')
-rw-r--r-- | core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java | 82 | ||||
-rw-r--r-- | core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java | 2 |
2 files changed, 15 insertions, 69 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 c256fea11..078f29ad7 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 @@ -8,9 +8,7 @@ import de.danoeh.antennapod.model.feed.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; +import static org.junit.Assert.assertThrows; public class FeedTest { @@ -24,92 +22,40 @@ public class FeedTest { } @Test - public void testCompareWithOther_feedImageDownloadUrlChanged() throws Exception { - setNewFeedImageDownloadUrl(); - feedHasChanged(); - } - - @Test - public void testCompareWithOther_sameFeedImage() throws Exception { - changedFeed.setImageUrl(FeedMother.IMAGE_URL); - feedHasNotChanged(); - } - - @Test - public void testCompareWithOther_feedImageRemoved() throws Exception { - feedImageRemoved(); - feedHasNotChanged(); - } - - @Test - public void testUpdateFromOther_feedImageDownloadUrlChanged() throws Exception { - setNewFeedImageDownloadUrl(); + public void testUpdateFromOther_feedImageDownloadUrlChanged() { + changedFeed.setImageUrl("http://example.com/new_picture"); original.updateFromOther(changedFeed); - feedImageWasUpdated(); + assertEquals(original.getImageUrl(), changedFeed.getImageUrl()); } @Test - public void testUpdateFromOther_feedImageRemoved() throws Exception { - feedImageRemoved(); + public void testUpdateFromOther_feedImageRemoved() { + changedFeed.setImageUrl(null); original.updateFromOther(changedFeed); - feedImageWasNotUpdated(); + assertEquals(anyFeed().getImageUrl(), original.getImageUrl()); } @Test - public void testUpdateFromOther_feedImageAdded() throws Exception { - feedHadNoImage(); - setNewFeedImageDownloadUrl(); + public void testUpdateFromOther_feedImageAdded() { + original.setImageUrl(null); + changedFeed.setImageUrl("http://example.com/new_picture"); original.updateFromOther(changedFeed); - feedImageWasUpdated(); + assertEquals(original.getImageUrl(), changedFeed.getImageUrl()); } @Test - public void testSetSortOrder_OnlyIntraFeedSortAllowed() throws Exception { + public void testSetSortOrder_OnlyIntraFeedSortAllowed() { 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 - } + assertThrows(IllegalArgumentException.class, () -> original.setSortOrder(sortOrder)); } } } @Test - public void testSetSortOrder_NullAllowed() throws Exception { + public void testSetSortOrder_NullAllowed() { original.setSortOrder(null); // should be okay } - - private void feedHasNotChanged() { - assertFalse(original.compareWithOther(changedFeed)); - } - - private void feedHadNoImage() { - original.setImageUrl(null); - } - - private void setNewFeedImageDownloadUrl() { - changedFeed.setImageUrl("http://example.com/new_picture"); - } - - private void feedHasChanged() { - assertTrue(original.compareWithOther(changedFeed)); - } - - private void feedImageRemoved() { - changedFeed.setImageUrl(null); - } - - private void feedImageWasUpdated() { - assertEquals(original.getImageUrl(), changedFeed.getImageUrl()); - } - - private void feedImageWasNotUpdated() { - assertEquals(anyFeed().getImageUrl(), original.getImageUrl()); - } - }
\ No newline at end of file diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java b/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java index 6bc3c09a2..df9617ab4 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/util/FeedItemUtilTest.java @@ -94,7 +94,7 @@ public class FeedItemUtilTest { } private static FeedItem createFeedItem(String feedLink, String itemLink) { - Feed feed = new Feed(); + Feed feed = new Feed("http://example.com/feed", null); feed.setLink(feedLink); FeedItem feedItem = new FeedItem(); feedItem.setLink(itemLink); |