diff options
author | Mengshi24 <58278376+Mengshi24@users.noreply.github.com> | 2021-06-05 09:40:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-05 18:40:26 +0200 |
commit | b35eaa4fa568ffd9de5ec8ae06d0cbec14ab11df (patch) | |
tree | faba1a2aae9edaf6a028e46a9aa7bd58676f26e9 | |
parent | 8bcbc7ae329187570d9449881628375c9f22eaaa (diff) | |
download | AntennaPod-b35eaa4fa568ffd9de5ec8ae06d0cbec14ab11df.zip |
Add a unit test under DbWriterTest.java (#5181)
-rw-r--r-- | core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java index 093c416d1..e38d4adb7 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java @@ -780,6 +780,34 @@ public class DbWriterTest { } @Test + public void testRemoveAllNewFlags() throws Exception { + final int numItems = 10; + Feed feed = new Feed("url", null, "title"); + feed.setItems(new ArrayList<>()); + for (int i = 0; i < numItems; i++) { + FeedItem item = new FeedItem(0, "title " + i, "id " + i, "link " + i, + new Date(), FeedItem.NEW, feed); + feed.getItems().add(item); + } + + PodDBAdapter adapter = PodDBAdapter.getInstance(); + adapter.open(); + adapter.setCompleteFeed(feed); + adapter.close(); + + assertTrue(feed.getId() != 0); + for (FeedItem item : feed.getItems()) { + assertTrue(item.getId() != 0); + } + + DBWriter.removeAllNewFlags(); + List<FeedItem> loadedItems = DBReader.getFeedItemList(feed); + for (FeedItem item : loadedItems) { + assertFalse(item.isNew()); + } + } + + @Test public void testMarkAllItemsReadSameFeed() throws Exception { final int numItems = 10; Feed feed = new Feed("url", null, "title"); |