Fix tests sometimes crashing because sync is not initialized (#7490)

This commit is contained in:
ByteHamster 2024-11-10 11:45:38 +01:00 committed by GitHub
parent 047a31b799
commit 26c0deaa09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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());
}
/**