diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-03-27 21:01:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-27 21:01:45 +0100 |
commit | 1dbda2fb8a070fb30b4314feca839525cfc701eb (patch) | |
tree | 30b63908a65915e60439353eea493b175fa959ae /core/src/test/java/de/danoeh | |
parent | 130da46f5d9c598ca76f4f2127c08bb4ef225b34 (diff) | |
download | AntennaPod-1dbda2fb8a070fb30b4314feca839525cfc701eb.zip |
Split up DBTasks which has unclear responsibilities (#7032)
Diffstat (limited to 'core/src/test/java/de/danoeh')
5 files changed, 17 insertions, 17 deletions
diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java index 5ff09287d..a0632b345 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java @@ -115,7 +115,7 @@ public class DbCleanupTests { List<File> files = new ArrayList<>(); populateItems(numItems, feed, items, files, FeedItem.PLAYED, false, false); - DBTasks.performAutoCleanup(context); + AutoDownloadManager.performAutoCleanup(context); for (int i = 0; i < files.size(); i++) { if (i < EPISODE_CACHE_SIZE) { assertTrue(files.get(i).exists()); @@ -174,7 +174,7 @@ public class DbCleanupTests { List<File> files = new ArrayList<>(); populateItems(numItems, feed, items, files, FeedItem.UNPLAYED, false, false); - DBTasks.performAutoCleanup(context); + AutoDownloadManager.performAutoCleanup(context); for (File file : files) { assertTrue(file.exists()); } @@ -190,7 +190,7 @@ public class DbCleanupTests { List<File> files = new ArrayList<>(); populateItems(numItems, feed, items, files, FeedItem.PLAYED, true, false); - DBTasks.performAutoCleanup(context); + AutoDownloadManager.performAutoCleanup(context); for (File file : files) { assertTrue(file.exists()); } @@ -230,7 +230,7 @@ public class DbCleanupTests { List<File> files = new ArrayList<>(); populateItems(numItems, feed, items, files, FeedItem.PLAYED, false, true); - DBTasks.performAutoCleanup(context); + AutoDownloadManager.performAutoCleanup(context); for (File file : files) { assertTrue(file.exists()); } diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java index 9f9902ad0..243bef941 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java @@ -114,7 +114,7 @@ public class DbNullCleanupAlgorithmTest { //noinspection ConstantConditions assertTrue(item.getMedia().getId() != 0); } - DBTasks.performAutoCleanup(context); + AutoDownloadManager.performAutoCleanup(context); for (int i = 0; i < files.size(); i++) { assertTrue(files.get(i).exists()); } diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java index dc8f4f45b..c14c3c2aa 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java @@ -40,7 +40,7 @@ public class DbQueueCleanupAlgorithmTest extends DbCleanupTests { List<File> files = new ArrayList<>(); populateItems(numItems, feed, items, files, FeedItem.UNPLAYED, false, false); - DBTasks.performAutoCleanup(context); + AutoDownloadManager.performAutoCleanup(context); for (int i = 0; i < files.size(); i++) { if (i < EPISODE_CACHE_SIZE) { assertTrue(files.get(i).exists()); diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java index 9f7ba095b..1357f4d4e 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java @@ -37,7 +37,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** - * Test class for {@link DBTasks}. + * Test class for {@link FeedDatabaseWriter}. */ @RunWith(RobolectricTestRunner.class) public class DbTasksTest { @@ -77,7 +77,7 @@ public class DbTasksTest { feed.getItems().add(new FeedItem(0, "item " + i, "id " + i, "link " + i, new Date(), FeedItem.UNPLAYED, feed)); } - Feed newFeed = DBTasks.updateFeed(context, feed, false); + Feed newFeed = FeedDatabaseWriter.updateFeed(context, feed, false); assertEquals(feed.getId(), newFeed.getId()); assertTrue(feed.getId() != 0); @@ -97,8 +97,8 @@ public class DbTasksTest { feed1.setItems(new ArrayList<>()); feed2.setItems(new ArrayList<>()); - Feed savedFeed1 = DBTasks.updateFeed(context, feed1, false); - Feed savedFeed2 = DBTasks.updateFeed(context, feed2, false); + Feed savedFeed1 = FeedDatabaseWriter.updateFeed(context, feed1, false); + Feed savedFeed2 = FeedDatabaseWriter.updateFeed(context, feed2, false); assertTrue(savedFeed1.getId() != savedFeed2.getId()); } @@ -135,7 +135,7 @@ public class DbTasksTest { new Date(i), FeedItem.UNPLAYED, feed)); } - final Feed newFeed = DBTasks.updateFeed(context, feed, false); + final Feed newFeed = FeedDatabaseWriter.updateFeed(context, feed, false); assertNotSame(newFeed, feed); updatedFeedTest(newFeed, feedID, itemIDs, numItemsOld, numItemsNew); @@ -167,7 +167,7 @@ public class DbTasksTest { list.add(item); feed.setItems(list); - final Feed newFeed = DBTasks.updateFeed(context, feed, false); + final Feed newFeed = FeedDatabaseWriter.updateFeed(context, feed, false); assertNotSame(newFeed, feed); final Feed feedFromDB = DBReader.getFeed(newFeed.getId()); @@ -190,7 +190,7 @@ public class DbTasksTest { // delete some items feed.getItems().subList(0, 2).clear(); - Feed newFeed = DBTasks.updateFeed(context, feed, true); + Feed newFeed = FeedDatabaseWriter.updateFeed(context, feed, true); assertEquals(8, newFeed.getItems().size()); // 10 - 2 = 8 items Feed feedFromDB = DBReader.getFeed(newFeed.getId()); @@ -217,7 +217,7 @@ public class DbTasksTest { FeedItem item = feed.getItemAtIndex(0); item.setItemIdentifier("id 0-duplicate"); item.setTitle("item 0 duplicate"); - Feed newFeed = DBTasks.updateFeed(context, feed, false); + Feed newFeed = FeedDatabaseWriter.updateFeed(context, feed, false); assertEquals(10, newFeed.getItems().size()); // id 1-duplicate replaces because the stream url is the same Feed feedFromDB = DBReader.getFeed(newFeed.getId()); diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java b/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java index 150ab04ba..b464a2508 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java +++ b/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java @@ -35,7 +35,7 @@ public class ExceptFavoriteCleanupAlgorithmTest extends DbCleanupTests { List<File> files = new ArrayList<>(); populateItems(numberOfItems, feed, items, files, FeedItem.UNPLAYED, false, false); - DBTasks.performAutoCleanup(context); + AutoDownloadManager.performAutoCleanup(context); for (int i = 0; i < files.size(); i++) { if (i < EPISODE_CACHE_SIZE) { assertTrue("Only enough items should be deleted", files.get(i).exists()); @@ -53,7 +53,7 @@ public class ExceptFavoriteCleanupAlgorithmTest extends DbCleanupTests { List<File> files = new ArrayList<>(); populateItems(numberOfItems, feed, items, files, FeedItem.UNPLAYED, true, false); - DBTasks.performAutoCleanup(context); + AutoDownloadManager.performAutoCleanup(context); for (int i = 0; i < files.size(); i++) { if (i < EPISODE_CACHE_SIZE) { assertTrue("Only enough items should be deleted", files.get(i).exists()); @@ -71,7 +71,7 @@ public class ExceptFavoriteCleanupAlgorithmTest extends DbCleanupTests { List<File> files = new ArrayList<>(); populateItems(numberOfItems, feed, items, files, FeedItem.UNPLAYED, false, true); - DBTasks.performAutoCleanup(context); + AutoDownloadManager.performAutoCleanup(context); for (int i = 0; i < files.size(); i++) { assertTrue("Favorite episodes should should not be deleted", files.get(i).exists()); } |