From 26c0deaa0963aabc1f7bac19d25bce911113c7ef Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 10 Nov 2024 11:45:38 +0100 Subject: [PATCH] Fix tests sometimes crashing because sync is not initialized (#7490) --- .../download/service/episode/autodownload/DbCleanupTests.java | 3 +++ .../episode/autodownload/DbQueueCleanupAlgorithmTest.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbCleanupTests.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbCleanupTests.java index 209ac4c7c..98b3878b0 100644 --- a/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbCleanupTests.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbCleanupTests.java @@ -16,6 +16,8 @@ import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.net.download.serviceinterface.AutoDownloadManager; +import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueue; +import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueStub; import de.danoeh.antennapod.storage.database.DBWriter; import de.danoeh.antennapod.storage.preferences.PlaybackPreferences; import de.danoeh.antennapod.storage.preferences.SynchronizationSettings; @@ -83,6 +85,7 @@ public class DbCleanupTests { PlaybackPreferences.init(context); SynchronizationSettings.init(context); AutoDownloadManager.setInstance(new AutoDownloadManagerImpl()); + SynchronizationQueue.setInstance(new SynchronizationQueueStub()); } @After diff --git a/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbQueueCleanupAlgorithmTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbQueueCleanupAlgorithmTest.java index b6d9a8f66..71fe34780 100644 --- a/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbQueueCleanupAlgorithmTest.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbQueueCleanupAlgorithmTest.java @@ -8,6 +8,8 @@ import java.util.List; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.net.download.serviceinterface.AutoDownloadManager; +import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueue; +import de.danoeh.antennapod.net.sync.serviceinterface.SynchronizationQueueStub; import de.danoeh.antennapod.storage.preferences.UserPreferences; import org.junit.Test; @@ -26,6 +28,7 @@ public class DbQueueCleanupAlgorithmTest extends DbCleanupTests { public DbQueueCleanupAlgorithmTest() { setCleanupAlgorithm(UserPreferences.EPISODE_CLEANUP_QUEUE); AutoDownloadManager.setInstance(new AutoDownloadManagerImpl()); + SynchronizationQueue.setInstance(new SynchronizationQueueStub()); } /**