summaryrefslogtreecommitdiff
path: root/app/src/androidTest/java/de/test/antennapod/service
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2022-11-05 13:40:44 +0100
committerByteHamster <info@bytehamster.com>2022-11-05 20:44:53 +0100
commit11292b598cc6867e32f4f313dfd6eff1197efdd3 (patch)
tree7eaefa01a6295c0eb1cacc036efc96f5572676b2 /app/src/androidTest/java/de/test/antennapod/service
parentae3971a58ff00755148b036794b7e5dc1c57017a (diff)
downloadAntennaPod-11292b598cc6867e32f4f313dfd6eff1197efdd3.zip
Remove dependency from other classes to DownloadService
Diffstat (limited to 'app/src/androidTest/java/de/test/antennapod/service')
-rw-r--r--app/src/androidTest/java/de/test/antennapod/service/download/DownloadServiceTest.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/service/download/DownloadServiceTest.java b/app/src/androidTest/java/de/test/antennapod/service/download/DownloadServiceTest.java
index 8aae95e69..4e255baeb 100644
--- a/app/src/androidTest/java/de/test/antennapod/service/download/DownloadServiceTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/service/download/DownloadServiceTest.java
@@ -9,6 +9,7 @@ import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
+import de.danoeh.antennapod.core.service.download.DownloadServiceInterface;
import de.test.antennapod.EspressoTestUtils;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
@@ -80,7 +81,7 @@ public class DownloadServiceTest {
public void tearDown() throws Exception {
DownloadService.setDownloaderFactory(origFactory);
Context context = InstrumentationRegistry.getInstrumentation().getTargetContext();
- DownloadService.cancelAll(context);
+ DownloadServiceInterface.get().cancelAll(context);
context.stopService(new Intent(context, DownloadService.class));
EspressoTestUtils.tryKillDownloadService();
}
@@ -113,7 +114,8 @@ public class DownloadServiceTest {
assertFalse("The media in test should not yet been downloaded",
DBReader.getFeedMedia(testMedia11.getId()).isDownloaded());
- DownloadService.download(InstrumentationRegistry.getInstrumentation().getTargetContext(), false,
+ DownloadServiceInterface.get()
+ .download(InstrumentationRegistry.getInstrumentation().getTargetContext(), false,
DownloadRequestCreator.create(testMedia11).build());
Awaitility.await()
.atMost(5000, TimeUnit.MILLISECONDS)
@@ -158,7 +160,8 @@ public class DownloadServiceTest {
}
withFeedItemEventListener(feedItemEventListener -> {
- DownloadService.download(InstrumentationRegistry.getInstrumentation().getTargetContext(), false,
+ DownloadServiceInterface.get()
+ .download(InstrumentationRegistry.getInstrumentation().getTargetContext(), false,
DownloadRequestCreator.create(testMedia11).build());
withDownloadEventListener(downloadEventListener ->
Awaitility.await("download is actually running")
@@ -175,7 +178,7 @@ public class DownloadServiceTest {
.atMost(2000, TimeUnit.MILLISECONDS)
.until(() -> feedItemEventListener.getEvents().size() >= 1);
}
- DownloadService.cancel(context, testMedia11.getDownload_url());
+ DownloadServiceInterface.get().cancel(context, testMedia11.getDownload_url());
final int totalNumEventsExpected = itemAlreadyInQueue ? 1 : 3;
Awaitility.await("item dequeue event + download termination event")
.atMost(2000, TimeUnit.MILLISECONDS)