diff options
author | Herbert Reiter <46045854+damoasda@users.noreply.github.com> | 2020-11-14 11:32:49 +0100 |
---|---|---|
committer | Herbert Reiter <46045854+damoasda@users.noreply.github.com> | 2020-11-14 11:32:49 +0100 |
commit | 3aa6b378346bd88ed53eb4eb6a6b1b537f917c55 (patch) | |
tree | 350292cd7fcfe5417100b99db1fdfd81ee8a10f6 /app/src/androidTest/java/de/test/antennapod/storage/AutoDownloadTest.java | |
parent | 5982ee07b43e1f042931d14c5044e95adb433726 (diff) | |
download | AntennaPod-3aa6b378346bd88ed53eb4eb6a6b1b537f917c55.zip |
Refactoring: Remove interface DBTasksCallbacks and class DBTasksCallbacksImpl
Diffstat (limited to 'app/src/androidTest/java/de/test/antennapod/storage/AutoDownloadTest.java')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/storage/AutoDownloadTest.java | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/storage/AutoDownloadTest.java b/app/src/androidTest/java/de/test/antennapod/storage/AutoDownloadTest.java index 5396b218d..1d2e3d9e8 100644 --- a/app/src/androidTest/java/de/test/antennapod/storage/AutoDownloadTest.java +++ b/app/src/androidTest/java/de/test/antennapod/storage/AutoDownloadTest.java @@ -4,14 +4,12 @@ import android.content.Context; import androidx.annotation.NonNull; import androidx.test.core.app.ApplicationProvider; import de.danoeh.antennapod.core.ClientConfig; -import de.danoeh.antennapod.core.DBTasksCallbacks; import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.storage.AutomaticDownloadAlgorithm; import de.danoeh.antennapod.core.storage.DBReader; -import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm; import de.danoeh.antennapod.core.util.playback.PlaybackServiceStarter; import de.test.antennapod.EspressoTestUtils; import de.test.antennapod.ui.UITestUtils; @@ -32,7 +30,7 @@ public class AutoDownloadTest { private Context context; private UITestUtils stubFeedsServer; - private DBTasksCallbacks dbTasksCallbacksOrig; + private AutomaticDownloadAlgorithm automaticDownloadAlgorithmOrig; @Before public void setUp() throws Exception { @@ -41,7 +39,7 @@ public class AutoDownloadTest { stubFeedsServer = new UITestUtils(context); stubFeedsServer.setup(); - dbTasksCallbacksOrig = ClientConfig.dbTasksCallbacks; + automaticDownloadAlgorithmOrig = ClientConfig.automaticDownloadAlgorithm; EspressoTestUtils.clearPreferences(); EspressoTestUtils.clearDatabase(); @@ -50,7 +48,7 @@ public class AutoDownloadTest { @After public void tearDown() throws Exception { - ClientConfig.dbTasksCallbacks = dbTasksCallbacksOrig; + ClientConfig.automaticDownloadAlgorithm = automaticDownloadAlgorithmOrig; EspressoTestUtils.tryKillPlaybackService(); stubFeedsServer.tearDown(); } @@ -79,7 +77,7 @@ public class AutoDownloadTest { // Setup: enable automatic download // it is not needed, as the actual automatic download is stubbed. StubDownloadAlgorithm stubDownloadAlgorithm = new StubDownloadAlgorithm(); - useDownloadAlgorithm(stubDownloadAlgorithm); + ClientConfig.automaticDownloadAlgorithm = stubDownloadAlgorithm; // Actual test // Play the first one in the queue @@ -113,20 +111,6 @@ public class AutoDownloadTest { .until(() -> item.getMedia().getId() == PlaybackPreferences.getCurrentlyPlayingFeedMediaId()); } - private void useDownloadAlgorithm(final AutomaticDownloadAlgorithm downloadAlgorithm) { - ClientConfig.dbTasksCallbacks = new DBTasksCallbacks() { - @Override - public AutomaticDownloadAlgorithm getAutomaticDownloadAlgorithm() { - return downloadAlgorithm; - } - - @Override - public EpisodeCleanupAlgorithm getEpisodeCacheCleanupAlgorithm() { - return dbTasksCallbacksOrig.getEpisodeCacheCleanupAlgorithm(); - } - }; - } - private static class StubDownloadAlgorithm implements AutomaticDownloadAlgorithm { private long currentlyPlaying = -1; |