diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-04-04 22:26:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-04 22:26:53 +0200 |
commit | 2143ab135182434911d4554a8ef08115eaa0d2d0 (patch) | |
tree | b380fdf38b34a032c5ea0ed5b5fa22dce7433723 | |
parent | 0288d4e51eb7eef565be8d814fb8c152383e5031 (diff) | |
download | AntennaPod-2143ab135182434911d4554a8ef08115eaa0d2d0.zip |
Move some tests from core module to their respective module (#7059)
35 files changed, 62 insertions, 70 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java index 8d956e3e4..93d9fe129 100644 --- a/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java +++ b/app/src/androidTest/java/de/test/antennapod/ui/PreferencesTest.java @@ -10,12 +10,12 @@ import androidx.test.filters.LargeTest; import androidx.test.rule.ActivityTestRule; import de.danoeh.antennapod.R; import de.danoeh.antennapod.ui.screen.preferences.PreferenceActivity; -import de.danoeh.antennapod.core.storage.APCleanupAlgorithm; -import de.danoeh.antennapod.core.storage.APNullCleanupAlgorithm; -import de.danoeh.antennapod.core.storage.APQueueCleanupAlgorithm; -import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithm; -import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithmFactory; -import de.danoeh.antennapod.core.storage.ExceptFavoriteCleanupAlgorithm; +import de.danoeh.antennapod.net.download.service.episode.autodownload.APCleanupAlgorithm; +import de.danoeh.antennapod.net.download.service.episode.autodownload.APNullCleanupAlgorithm; +import de.danoeh.antennapod.net.download.service.episode.autodownload.APQueueCleanupAlgorithm; +import de.danoeh.antennapod.net.download.service.episode.autodownload.EpisodeCleanupAlgorithm; +import de.danoeh.antennapod.net.download.service.episode.autodownload.EpisodeCleanupAlgorithmFactory; +import de.danoeh.antennapod.net.download.service.episode.autodownload.ExceptFavoriteCleanupAlgorithm; import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation; import de.test.antennapod.EspressoTestUtils; diff --git a/app/src/main/java/de/danoeh/antennapod/ClientConfigurator.java b/app/src/main/java/de/danoeh/antennapod/ClientConfigurator.java index 43be25afa..a17206a21 100644 --- a/app/src/main/java/de/danoeh/antennapod/ClientConfigurator.java +++ b/app/src/main/java/de/danoeh/antennapod/ClientConfigurator.java @@ -3,7 +3,7 @@ package de.danoeh.antennapod; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import de.danoeh.antennapod.core.storage.AutoDownloadManagerImpl; +import de.danoeh.antennapod.net.download.service.episode.autodownload.AutoDownloadManagerImpl; import de.danoeh.antennapod.net.download.service.feed.FeedUpdateManagerImpl; import de.danoeh.antennapod.net.download.serviceinterface.AutoDownloadManager; import de.danoeh.antennapod.net.download.serviceinterface.FeedUpdateManager; diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/drawer/NavDrawerFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/drawer/NavDrawerFragment.java index fabcaf652..98690e0cf 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/drawer/NavDrawerFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/drawer/NavDrawerFragment.java @@ -33,7 +33,7 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.shape.MaterialShapeDrawable; import com.google.android.material.shape.ShapeAppearanceModel; -import de.danoeh.antennapod.core.storage.EpisodeCleanupAlgorithmFactory; +import de.danoeh.antennapod.net.download.service.episode.autodownload.EpisodeCleanupAlgorithmFactory; import de.danoeh.antennapod.ui.screen.AddFeedFragment; import de.danoeh.antennapod.ui.screen.AllEpisodesFragment; import de.danoeh.antennapod.ui.screen.InboxFragment; diff --git a/build.gradle b/build.gradle index 979460547..52e53093c 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,7 @@ project.ext { runnerVersion = "1.5.0" rulesVersion = "1.5.0" testCoreVersion = "1.5.0" + mockitoVersion = "5.11.0" } checkstyle { diff --git a/core/build.gradle b/core/build.gradle index 75a585b08..ad0ad1e3b 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -56,7 +56,7 @@ dependencies { testImplementation "androidx.test:core:$testCoreVersion" testImplementation "org.awaitility:awaitility:$awaitilityVersion" testImplementation "junit:junit:$junitVersion" - testImplementation 'org.mockito:mockito-core:5.11.0' + testImplementation "org.mockito:mockito-core:$mockitoVersion" testImplementation "org.robolectric:robolectric:$robolectricVersion" testImplementation 'javax.inject:javax.inject:1' androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion" diff --git a/model/build.gradle b/model/build.gradle index fa0f3679c..14b79c6ae 100644 --- a/model/build.gradle +++ b/model/build.gradle @@ -18,4 +18,5 @@ dependencies { testImplementation "junit:junit:$junitVersion" testImplementation "androidx.test:core:$testCoreVersion" + testImplementation "org.mockito:mockito-core:$mockitoVersion" } diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedFilterTest.java b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedFilterTest.java index cc8e1636c..c58450643 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedFilterTest.java +++ b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedFilterTest.java @@ -1,12 +1,9 @@ -package de.danoeh.antennapod.core.feed; - -import de.danoeh.antennapod.ui.common.Converter; -import de.danoeh.antennapod.model.feed.FeedFilter; -import de.danoeh.antennapod.model.feed.FeedItem; -import de.danoeh.antennapod.model.feed.FeedMedia; +package de.danoeh.antennapod.model.feed; import org.junit.Test; +import java.util.concurrent.TimeUnit; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -133,7 +130,7 @@ public class FeedFilterTest { FeedItem download = new FeedItem(); download.setTitle("Hello friend!"); FeedMedia downloadMedia = FeedMediaMother.anyFeedMedia(); - downloadMedia.setDuration(Converter.durationStringShortToMs("05:00", false)); + downloadMedia.setDuration((int) TimeUnit.MILLISECONDS.convert(5, TimeUnit.MINUTES)); download.setMedia(downloadMedia); // because duration of the media in unknown FeedItem download2 = new FeedItem(); @@ -144,7 +141,7 @@ public class FeedFilterTest { FeedItem doNotDownload = new FeedItem(); doNotDownload.setTitle("Hello friend!"); FeedMedia doNotDownloadMedia = FeedMediaMother.anyFeedMedia(); - doNotDownloadMedia.setDuration(Converter.durationStringShortToMs("02:00", false)); + doNotDownloadMedia.setDuration((int) TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES)); doNotDownload.setMedia(doNotDownloadMedia); int minimalDurationFilter = 3 * 60; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemMother.java b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedItemMother.java index cd96dca89..cf271b31d 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemMother.java +++ b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedItemMother.java @@ -1,10 +1,8 @@ -package de.danoeh.antennapod.core.feed; - -import de.danoeh.antennapod.model.feed.FeedItem; +package de.danoeh.antennapod.model.feed; import java.util.Date; -import static de.danoeh.antennapod.core.feed.FeedMother.anyFeed; +import static de.danoeh.antennapod.model.feed.FeedMother.anyFeed; class FeedItemMother { private static final String IMAGE_URL = "http://example.com/image"; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemTest.java b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedItemTest.java index 62775b84b..633176eb2 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedItemTest.java +++ b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedItemTest.java @@ -1,13 +1,12 @@ -package de.danoeh.antennapod.core.feed; +package de.danoeh.antennapod.model.feed; -import de.danoeh.antennapod.model.feed.FeedItem; import org.junit.Before; import org.junit.Test; import java.text.SimpleDateFormat; import java.util.Date; -import static de.danoeh.antennapod.core.feed.FeedItemMother.anyFeedItemWithImage; +import static de.danoeh.antennapod.model.feed.FeedItemMother.anyFeedItemWithImage; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaMother.java b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedMediaMother.java index 35a85af02..f18f43f18 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaMother.java +++ b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedMediaMother.java @@ -1,6 +1,4 @@ -package de.danoeh.antennapod.core.feed; - -import de.danoeh.antennapod.model.feed.FeedMedia; +package de.danoeh.antennapod.model.feed; class FeedMediaMother { diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaTest.java b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedMediaTest.java index 43d855cc4..ef2792edc 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMediaTest.java +++ b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedMediaTest.java @@ -1,11 +1,9 @@ -package de.danoeh.antennapod.core.feed; +package de.danoeh.antennapod.model.feed; -import de.danoeh.antennapod.model.feed.FeedItem; -import de.danoeh.antennapod.model.feed.FeedMedia; import org.junit.Before; import org.junit.Test; -import static de.danoeh.antennapod.core.feed.FeedMediaMother.anyFeedMedia; +import static de.danoeh.antennapod.model.feed.FeedMediaMother.anyFeedMedia; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedMother.java index 7616f8f91..ddb3b7fa8 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedMother.java +++ b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedMother.java @@ -1,6 +1,4 @@ -package de.danoeh.antennapod.core.feed; - -import de.danoeh.antennapod.model.feed.Feed; +package de.danoeh.antennapod.model.feed; public class FeedMother { public static final String IMAGE_URL = "http://example.com/image"; diff --git a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedTest.java index 078f29ad7..34c5e76d9 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/feed/FeedTest.java +++ b/model/src/test/java/de/danoeh/antennapod/model/feed/FeedTest.java @@ -1,12 +1,9 @@ -package de.danoeh.antennapod.core.feed; +package de.danoeh.antennapod.model.feed; -import de.danoeh.antennapod.model.feed.Feed; import org.junit.Before; import org.junit.Test; -import de.danoeh.antennapod.model.feed.SortOrder; - -import static de.danoeh.antennapod.core.feed.FeedMother.anyFeed; +import static de.danoeh.antennapod.model.feed.FeedMother.anyFeed; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThrows; diff --git a/net/download/service/build.gradle b/net/download/service/build.gradle index 75d6b26de..789fb3aef 100644 --- a/net/download/service/build.gradle +++ b/net/download/service/build.gradle @@ -43,5 +43,6 @@ dependencies { testImplementation "junit:junit:$junitVersion" testImplementation "org.robolectric:robolectric:$robolectricVersion" testImplementation "org.awaitility:awaitility:$awaitilityVersion" - testImplementation 'org.mockito:mockito-core:5.11.0' + testImplementation "org.mockito:mockito-core:$mockitoVersion" + testImplementation "androidx.preference:preference:$preferenceVersion" } diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APCleanupAlgorithm.java index d1de1f616..bc50c8c1f 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APCleanupAlgorithm.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; import androidx.annotation.NonNull; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APNullCleanupAlgorithm.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APNullCleanupAlgorithm.java index 9cec62d83..f550cecf8 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/APNullCleanupAlgorithm.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APNullCleanupAlgorithm.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; import android.util.Log; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APQueueCleanupAlgorithm.java index 74ee43cf0..ea550599b 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/APQueueCleanupAlgorithm.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APQueueCleanupAlgorithm.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; import androidx.annotation.NonNull; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/AutoDownloadManagerImpl.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/AutoDownloadManagerImpl.java index b00375ffe..2b0eb4d62 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/AutoDownloadManagerImpl.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/AutoDownloadManagerImpl.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; import android.util.Log; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/AutomaticDownloadAlgorithm.java index dbcc899ba..828211ba1 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/AutomaticDownloadAlgorithm.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/AutomaticDownloadAlgorithm.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; import android.content.Intent; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/EpisodeCleanupAlgorithm.java index 782abb4e7..eb582a19a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithm.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/EpisodeCleanupAlgorithm.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithmFactory.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/EpisodeCleanupAlgorithmFactory.java index f4d23e04d..de8a2feda 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/EpisodeCleanupAlgorithmFactory.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/EpisodeCleanupAlgorithmFactory.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import de.danoeh.antennapod.storage.preferences.UserPreferences; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithm.java b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/ExceptFavoriteCleanupAlgorithm.java index 2fc2ef902..46dfcffdc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithm.java +++ b/net/download/service/src/main/java/de/danoeh/antennapod/net/download/service/episode/autodownload/ExceptFavoriteCleanupAlgorithm.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; import android.util.Log; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithmTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APCleanupAlgorithmTest.java index 946181d52..0072e7ac0 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithmTest.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/APCleanupAlgorithmTest.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import org.junit.Test; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbCleanupTests.java index a29a87b05..dc9c8749a 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbCleanupTests.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbCleanupTests.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; import android.content.SharedPreferences; @@ -28,7 +28,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; -import static de.danoeh.antennapod.core.storage.DbTestUtils.saveFeedlist; +import static de.danoeh.antennapod.net.download.service.episode.autodownload.DbTestUtils.saveFeedlist; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbNullCleanupAlgorithmTest.java index bbcf362b9..032fc2013 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbNullCleanupAlgorithmTest.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbNullCleanupAlgorithmTest.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; import android.content.SharedPreferences; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbQueueCleanupAlgorithmTest.java index 04762b123..b6d9a8f66 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbQueueCleanupAlgorithmTest.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbQueueCleanupAlgorithmTest.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import java.io.File; import java.io.IOException; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbReaderTest.java index 17e023da5..f36408957 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbReaderTest.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbReaderTest.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; @@ -33,7 +33,7 @@ import org.junit.runner.RunWith; import org.robolectric.ParameterizedRobolectricTestRunner; import org.robolectric.RobolectricTestRunner; -import static de.danoeh.antennapod.core.storage.DbTestUtils.saveFeedlist; +import static de.danoeh.antennapod.net.download.service.episode.autodownload.DbTestUtils.saveFeedlist; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbTasksTest.java index 1f90dd7a9..776319acf 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTasksTest.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbTasksTest.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbTestUtils.java index 0dd9c1396..c104df9e8 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbTestUtils.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbTestUtils.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import java.util.ArrayList; import java.util.Date; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java index 806b8f08f..38d3e5dd0 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/DbWriterTest.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/DbWriterTest.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import android.content.Context; import android.content.SharedPreferences; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/ExceptFavoriteCleanupAlgorithmTest.java index df26b9e4f..dd77606dc 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/ExceptFavoriteCleanupAlgorithmTest.java +++ b/net/download/service/src/test/java/de/danoeh/antennapod/net/download/service/episode/autodownload/ExceptFavoriteCleanupAlgorithmTest.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.net.download.service.episode.autodownload; import de.danoeh.antennapod.net.download.serviceinterface.AutoDownloadManager; import org.junit.Test; diff --git a/playback/service/build.gradle b/playback/service/build.gradle index e49052c44..b8c47df8e 100644 --- a/playback/service/build.gradle +++ b/playback/service/build.gradle @@ -40,5 +40,5 @@ dependencies { implementation "org.apache.commons:commons-lang3:$commonslangVersion" testImplementation "junit:junit:$junitVersion" - testImplementation 'org.mockito:mockito-core:5.11.0' + testImplementation "org.mockito:mockito-core:$mockitoVersion" } diff --git a/core/src/test/java/de/danoeh/antennapod/core/util/CollectionTestUtil.java b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/CollectionTestUtil.java index 21f1ef5d4..244348c2a 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/util/CollectionTestUtil.java +++ b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/CollectionTestUtil.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.util; +package de.danoeh.antennapod.storage.database; import java.util.ArrayList; import java.util.Arrays; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/FeedItemDuplicateGuesserTest.java b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/FeedItemDuplicateGuesserTest.java index 38dbe8caa..52140bccf 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/FeedItemDuplicateGuesserTest.java +++ b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/FeedItemDuplicateGuesserTest.java @@ -1,4 +1,4 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.storage.database; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; diff --git a/core/src/test/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculatorTest.java b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/ItemEnqueuePositionCalculatorTest.java index dfad714a8..9b519b6aa 100644 --- a/core/src/test/java/de/danoeh/antennapod/core/storage/ItemEnqueuePositionCalculatorTest.java +++ b/storage/database/src/test/java/de/danoeh/antennapod/storage/database/ItemEnqueuePositionCalculatorTest.java @@ -1,9 +1,9 @@ -package de.danoeh.antennapod.core.storage; +package de.danoeh.antennapod.storage.database; +import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.playback.RemoteMedia; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterface; import de.danoeh.antennapod.net.download.serviceinterface.DownloadServiceInterfaceStub; -import de.danoeh.antennapod.storage.database.ItemEnqueuePositionCalculator; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -19,16 +19,14 @@ import java.util.stream.Collectors; import de.danoeh.antennapod.model.feed.FeedItem; import de.danoeh.antennapod.model.feed.FeedMedia; -import de.danoeh.antennapod.core.feed.FeedMother; import de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation; import de.danoeh.antennapod.model.playback.Playable; import static de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation.AFTER_CURRENTLY_PLAYING; import static de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation.BACK; import static de.danoeh.antennapod.storage.preferences.UserPreferences.EnqueueLocation.FRONT; -import static de.danoeh.antennapod.core.util.CollectionTestUtil.concat; -import static de.danoeh.antennapod.core.util.CollectionTestUtil.list; -import static de.danoeh.antennapod.core.util.FeedItemUtil.getIdList; +import static de.danoeh.antennapod.storage.database.CollectionTestUtil.concat; +import static de.danoeh.antennapod.storage.database.CollectionTestUtil.list; import static java.util.Collections.emptyList; import static org.junit.Assert.assertEquals; @@ -136,7 +134,10 @@ public class ItemEnqueuePositionCalculatorTest { List<Long> idsExpected) { int posActual = calculator.calcPosition(queue, currentlyPlaying); queue.add(posActual, itemToAdd); - assertEquals(message, idsExpected, getIdList(queue)); + assertEquals(message, idsExpected.size(), queue.size()); + for (int i = 0; i < idsExpected.size(); i++) { + assertEquals(message, (long) idsExpected.get(i), queue.get(i).getId()); + } } static final List<FeedItem> QUEUE_EMPTY = Collections.unmodifiableList(emptyList()); @@ -167,8 +168,11 @@ public class ItemEnqueuePositionCalculatorTest { static FeedItem createFeedItem(long id) { + Feed feed = new Feed(0, null, "title", "http://example.com", "This is the description", + "http://example.com/payment", "Daniel", "en", null, "http://example.com/feed", + "http://example.com/image", null, "http://example.com/feed", System.currentTimeMillis()); FeedItem item = new FeedItem(id, "Item" + id, "ItemId" + id, "url", - new Date(), FeedItem.PLAYED, FeedMother.anyFeed()); + new Date(), FeedItem.PLAYED, feed); FeedMedia media = new FeedMedia(item, "http://download.url.net/" + id, 1234567, "audio/mpeg"); media.setId(item.getId()); item.setMedia(media); |