Add a unit test under DbWriterTest.java (#5181)
This commit is contained in:
parent
8bcbc7ae32
commit
b35eaa4fa5
|
@ -779,6 +779,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;
|
||||
|
|
Loading…
Reference in New Issue