diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2017-05-31 19:04:08 +0200 |
---|---|---|
committer | Martin Fietz <Martin.Fietz@gmail.com> | 2017-06-05 11:26:42 +0200 |
commit | 397cd8c636b9c77c4d4f04ff057a31a49ba370ce (patch) | |
tree | efacd7f9298c6c766dcfe221a40f70444f857aad /app/src | |
parent | a8d72b3c6f3af996d57fc571d029187d88dcfd20 (diff) | |
download | AntennaPod-397cd8c636b9c77c4d4f04ff057a31a49ba370ce.zip |
Remove unused methods from DB Reader and DB Adapter
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java b/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java index 9386e3bd6..0c5cf10cb 100644 --- a/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/DBReaderTest.java @@ -218,58 +218,43 @@ public class DBReaderTest extends InstrumentationTestCase { } } - private List<FeedItem> saveUnreadItems(int numItems) { - if (numItems <= 0) { - throw new IllegalArgumentException("numItems<=0"); - } + private List<FeedItem> saveNewItems(int numItems) { List<Feed> feeds = saveFeedlist(numItems, numItems, true); List<FeedItem> items = new ArrayList<>(); for (Feed f : feeds) { items.addAll(f.getItems()); } - List<FeedItem> unread = new ArrayList<>(); + List<FeedItem> newItems = new ArrayList<>(); Random random = new Random(); - while (unread.size() < numItems) { + while (newItems.size() < numItems) { int i = random.nextInt(numItems); - if (!unread.contains(items.get(i))) { + if (!newItems.contains(items.get(i))) { FeedItem item = items.get(i); - item.setPlayed(false); - unread.add(item); + item.setNew(); + newItems.add(item); } } PodDBAdapter adapter = PodDBAdapter.getInstance(); adapter.open(); - adapter.setFeedItemlist(unread); + adapter.setFeedItemlist(newItems); adapter.close(); - return unread; - } - - public void testGetUnreadItemsList() { - final int numItems = 10; - - List<FeedItem> unread = saveUnreadItems(numItems); - List<FeedItem> unreadSaved = DBReader.getUnreadItemsList(); - assertNotNull(unreadSaved); - assertTrue(unread.size() == unreadSaved.size()); - for (FeedItem item : unreadSaved) { - assertFalse(item.isPlayed()); - } + return newItems; } public void testGetNewItemIds() { final int numItems = 10; - List<FeedItem> unread = saveUnreadItems(numItems); - long[] unreadIds = new long[unread.size()]; - for (int i = 0; i < unread.size(); i++) { - unreadIds[i] = unread.get(i).getId(); + List<FeedItem> newItems = saveNewItems(numItems); + long[] unreadIds = new long[newItems.size()]; + for (int i = 0; i < newItems.size(); i++) { + unreadIds[i] = newItems.get(i).getId(); } - List<FeedItem> unreadSaved = DBReader.getUnreadItemsList(); - assertNotNull(unreadSaved); - assertTrue(unread.size() == unreadSaved.size()); - for(int i=0; i < unreadSaved.size(); i++) { - long savedId = unreadSaved.get(i).getId(); + List<FeedItem> newItemsSaved = DBReader.getNewItemsList(); + assertNotNull(newItemsSaved); + assertTrue(newItems.size() == newItemsSaved.size()); + for(int i=0; i < newItemsSaved.size(); i++) { + long savedId = newItemsSaved.get(i).getId(); boolean found = false; for (long id : unreadIds) { if (id == savedId) { |