diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 355ec42c01..04a0c521a5 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -85,7 +85,7 @@ dependencies {
implementation(projects.core.data)
implementation(projects.core.model)
implementation(projects.core.analytics)
- implementation(projects.sync.work)
+ implementation(projects.sync)
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.compose.material3.adaptive)
@@ -105,30 +105,32 @@ dependencies {
implementation(libs.coil.kt)
ksp(libs.hilt.compiler)
+ kspTest(libs.hilt.compiler)
+ kspAndroidTest(libs.hilt.compiler)
debugImplementation(libs.androidx.compose.ui.testManifest)
debugImplementation(projects.uiTestHiltManifest)
- kspTest(libs.hilt.compiler)
-
- testImplementation(projects.core.dataTest)
testImplementation(projects.core.testing)
- testImplementation(projects.sync.syncTest)
testImplementation(libs.androidx.compose.ui.test)
testImplementation(libs.androidx.work.testing)
testImplementation(libs.hilt.android.testing)
+ testImplementation(testFixtures(projects.core.data))
+ testImplementation(testFixtures(projects.sync))
testDemoImplementation(libs.robolectric)
testDemoImplementation(libs.roborazzi)
testDemoImplementation(projects.core.screenshotTesting)
+ testDemoImplementation(testFixtures(projects.core.data))
androidTestImplementation(projects.core.testing)
- androidTestImplementation(projects.core.dataTest)
- androidTestImplementation(projects.core.datastoreTest)
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.navigation.testing)
androidTestImplementation(libs.androidx.compose.ui.test)
androidTestImplementation(libs.hilt.android.testing)
+ androidTestImplementation(testFixtures(projects.core.data))
+ androidTestImplementation(testFixtures(projects.core.datastore))
+ androidTestImplementation(testFixtures(projects.sync))
baselineProfile(projects.benchmarks)
}
diff --git a/app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppStateTest.kt b/app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppStateTest.kt
index c2c74458d2..32f3d17e48 100644
--- a/app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppStateTest.kt
+++ b/app/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppStateTest.kt
@@ -27,10 +27,10 @@ import androidx.navigation.compose.composable
import androidx.navigation.createGraph
import androidx.navigation.testing.TestNavHostController
import com.google.samples.apps.nowinandroid.core.data.repository.CompositeUserNewsResourceRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestNewsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
-import com.google.samples.apps.nowinandroid.core.testing.util.TestNetworkMonitor
-import com.google.samples.apps.nowinandroid.core.testing.util.TestTimeZoneMonitor
+import com.google.samples.apps.nowinandroid.core.data.repository.TestNewsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestUserDataRepository
+import com.google.samples.apps.nowinandroid.core.data.util.TestNetworkMonitor
+import com.google.samples.apps.nowinandroid.core.data.util.TestTimeZoneMonitor
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import kotlinx.coroutines.test.UnconfinedTestDispatcher
diff --git a/app/src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui/SnackbarScreenshotTests.kt b/app/src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui/SnackbarScreenshotTests.kt
index 6f12dd6205..ce6bcbcf0f 100644
--- a/app/src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui/SnackbarScreenshotTests.kt
+++ b/app/src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui/SnackbarScreenshotTests.kt
@@ -34,9 +34,9 @@ import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.window.core.layout.WindowSizeClass
import com.github.takahirom.roborazzi.captureRoboImage
+import com.google.samples.apps.nowinandroid.core.data.repository.FakeUserDataRepository
import com.google.samples.apps.nowinandroid.core.data.repository.TopicsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.UserNewsResourceRepository
-import com.google.samples.apps.nowinandroid.core.data.test.repository.FakeUserDataRepository
import com.google.samples.apps.nowinandroid.core.data.util.NetworkMonitor
import com.google.samples.apps.nowinandroid.core.data.util.TimeZoneMonitor
import com.google.samples.apps.nowinandroid.core.designsystem.theme.NiaTheme
diff --git a/core/analytics/build.gradle.kts b/core/analytics/build.gradle.kts
index 023574e6f0..cc0093bbe6 100644
--- a/core/analytics/build.gradle.kts
+++ b/core/analytics/build.gradle.kts
@@ -21,6 +21,7 @@ plugins {
android {
namespace = "com.google.samples.apps.nowinandroid.core.analytics"
+ testFixtures.enable = true
}
dependencies {
@@ -28,4 +29,8 @@ dependencies {
prodImplementation(platform(libs.firebase.bom))
prodImplementation(libs.firebase.analytics)
+
+ testFixturesImplementation(libs.androidx.compose.runtime) {
+ because("https://issuetracker.google.com/issues/259523353#comment32")
+ }
}
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestAnalyticsHelper.kt b/core/analytics/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/analytics/TestAnalyticsHelper.kt
similarity index 80%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestAnalyticsHelper.kt
rename to core/analytics/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/analytics/TestAnalyticsHelper.kt
index 5f72d30e69..fd3c240117 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestAnalyticsHelper.kt
+++ b/core/analytics/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/analytics/TestAnalyticsHelper.kt
@@ -14,10 +14,7 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.util
-
-import com.google.samples.apps.nowinandroid.core.analytics.AnalyticsEvent
-import com.google.samples.apps.nowinandroid.core.analytics.AnalyticsHelper
+package com.google.samples.apps.nowinandroid.core.analytics
class TestAnalyticsHelper : AnalyticsHelper {
diff --git a/core/data-test/README.md b/core/data-test/README.md
deleted file mode 100644
index 977ee10e41..0000000000
--- a/core/data-test/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# :core:data-test module
-## Dependency graph
-![Dependency graph](../../docs/images/graphs/dep_graph_core_data_test.svg)
diff --git a/core/data-test/build.gradle.kts b/core/data-test/build.gradle.kts
deleted file mode 100644
index b166df2880..0000000000
--- a/core/data-test/build.gradle.kts
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-plugins {
- alias(libs.plugins.nowinandroid.android.library)
- alias(libs.plugins.nowinandroid.android.hilt)
-}
-
-android {
- namespace = "com.google.samples.apps.nowinandroid.core.data.test"
-}
-
-dependencies {
- api(projects.core.data)
-
- implementation(libs.hilt.android.testing)
-}
diff --git a/core/data-test/src/main/AndroidManifest.xml b/core/data-test/src/main/AndroidManifest.xml
deleted file mode 100644
index 27a3ea8b09..0000000000
--- a/core/data-test/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts
index 142637ff9c..893a1d0bbb 100644
--- a/core/data/build.gradle.kts
+++ b/core/data/build.gradle.kts
@@ -28,6 +28,7 @@ android {
isReturnDefaultValues = true
}
}
+ testFixtures.enable = true
}
dependencies {
@@ -41,6 +42,10 @@ dependencies {
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.kotlinx.serialization.json)
- testImplementation(projects.core.datastoreTest)
testImplementation(projects.core.testing)
+ testImplementation(testFixtures(projects.core.datastore))
+ testImplementation(testFixtures(projects.core.notifications))
+
+ kspTestFixtures(libs.hilt.compiler)
+ testFixturesImplementation(libs.hilt.android.testing)
}
diff --git a/core/data/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/di/DataModule.kt b/core/data/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/di/DataModule.kt
index fa4bde8b83..432dab032c 100644
--- a/core/data/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/di/DataModule.kt
+++ b/core/data/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/di/DataModule.kt
@@ -40,35 +40,23 @@ import dagger.hilt.components.SingletonComponent
abstract class DataModule {
@Binds
- internal abstract fun bindsTopicRepository(
- topicsRepository: OfflineFirstTopicsRepository,
- ): TopicsRepository
+ internal abstract fun bindsTopicRepository(it: OfflineFirstTopicsRepository): TopicsRepository
@Binds
- internal abstract fun bindsNewsResourceRepository(
- newsRepository: OfflineFirstNewsRepository,
- ): NewsRepository
+ internal abstract fun bindsNewsResourceRepository(it: OfflineFirstNewsRepository): NewsRepository
@Binds
- internal abstract fun bindsUserDataRepository(
- userDataRepository: OfflineFirstUserDataRepository,
- ): UserDataRepository
+ internal abstract fun bindsUserDataRepository(it: OfflineFirstUserDataRepository): UserDataRepository
@Binds
- internal abstract fun bindsRecentSearchRepository(
- recentSearchRepository: DefaultRecentSearchRepository,
- ): RecentSearchRepository
+ internal abstract fun bindsRecentSearchRepository(it: DefaultRecentSearchRepository): RecentSearchRepository
@Binds
- internal abstract fun bindsSearchContentsRepository(
- searchContentsRepository: DefaultSearchContentsRepository,
- ): SearchContentsRepository
+ internal abstract fun bindsSearchContentsRepository(it: DefaultSearchContentsRepository): SearchContentsRepository
@Binds
- internal abstract fun bindsNetworkMonitor(
- networkMonitor: ConnectivityManagerNetworkMonitor,
- ): NetworkMonitor
+ internal abstract fun bindsNetworkMonitor(it: ConnectivityManagerNetworkMonitor): NetworkMonitor
@Binds
- internal abstract fun binds(impl: TimeZoneBroadcastMonitor): TimeZoneMonitor
+ internal abstract fun bindsTimeZoneMonitor(it: TimeZoneBroadcastMonitor): TimeZoneMonitor
}
diff --git a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/CompositeUserNewsResourceRepositoryTest.kt b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/CompositeUserNewsResourceRepositoryTest.kt
index 05811f4be1..e28f439bb4 100644
--- a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/CompositeUserNewsResourceRepositoryTest.kt
+++ b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/CompositeUserNewsResourceRepositoryTest.kt
@@ -18,12 +18,12 @@ package com.google.samples.apps.nowinandroid.core.data
import com.google.samples.apps.nowinandroid.core.data.repository.CompositeUserNewsResourceRepository
import com.google.samples.apps.nowinandroid.core.data.repository.NewsResourceQuery
+import com.google.samples.apps.nowinandroid.core.data.repository.TestNewsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestUserDataRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.emptyUserData
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import com.google.samples.apps.nowinandroid.core.model.data.Topic
import com.google.samples.apps.nowinandroid.core.model.data.mapToUserNewsResources
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestNewsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.emptyUserData
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Instant
diff --git a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstNewsRepositoryTest.kt b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstNewsRepositoryTest.kt
index 47c3996c44..966f157ede 100644
--- a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstNewsRepositoryTest.kt
+++ b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstNewsRepositoryTest.kt
@@ -32,12 +32,12 @@ import com.google.samples.apps.nowinandroid.core.database.model.PopulatedNewsRes
import com.google.samples.apps.nowinandroid.core.database.model.TopicEntity
import com.google.samples.apps.nowinandroid.core.database.model.asExternalModel
import com.google.samples.apps.nowinandroid.core.datastore.NiaPreferencesDataSource
-import com.google.samples.apps.nowinandroid.core.datastore.test.testUserPreferencesDataStore
+import com.google.samples.apps.nowinandroid.core.datastore.di.testUserPreferencesDataStore
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import com.google.samples.apps.nowinandroid.core.model.data.Topic
import com.google.samples.apps.nowinandroid.core.network.model.NetworkChangeList
import com.google.samples.apps.nowinandroid.core.network.model.NetworkNewsResource
-import com.google.samples.apps.nowinandroid.core.testing.notifications.TestNotifier
+import com.google.samples.apps.nowinandroid.core.notifications.TestNotifier
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.UnconfinedTestDispatcher
diff --git a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt
index 3bd314eae5..0be0a9a3b4 100644
--- a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt
+++ b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstTopicsRepositoryTest.kt
@@ -25,7 +25,7 @@ import com.google.samples.apps.nowinandroid.core.database.dao.TopicDao
import com.google.samples.apps.nowinandroid.core.database.model.TopicEntity
import com.google.samples.apps.nowinandroid.core.database.model.asExternalModel
import com.google.samples.apps.nowinandroid.core.datastore.NiaPreferencesDataSource
-import com.google.samples.apps.nowinandroid.core.datastore.test.testUserPreferencesDataStore
+import com.google.samples.apps.nowinandroid.core.datastore.di.testUserPreferencesDataStore
import com.google.samples.apps.nowinandroid.core.model.data.Topic
import com.google.samples.apps.nowinandroid.core.network.model.NetworkTopic
import kotlinx.coroutines.flow.first
diff --git a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepositoryTest.kt b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepositoryTest.kt
index 422e2cfb7e..3738b2ca87 100644
--- a/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepositoryTest.kt
+++ b/core/data/src/test/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/OfflineFirstUserDataRepositoryTest.kt
@@ -18,7 +18,7 @@ package com.google.samples.apps.nowinandroid.core.data.repository
import com.google.samples.apps.nowinandroid.core.analytics.NoOpAnalyticsHelper
import com.google.samples.apps.nowinandroid.core.datastore.NiaPreferencesDataSource
-import com.google.samples.apps.nowinandroid.core.datastore.test.testUserPreferencesDataStore
+import com.google.samples.apps.nowinandroid.core.datastore.di.testUserPreferencesDataStore
import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig
import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand
import com.google.samples.apps.nowinandroid.core.model.data.UserData
diff --git a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/TestDataModule.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/di/TestDataModule.kt
similarity index 52%
rename from core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/TestDataModule.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/di/TestDataModule.kt
index 46158479c9..ddc965d4fe 100644
--- a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/TestDataModule.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/di/TestDataModule.kt
@@ -14,19 +14,20 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.data.test
+package com.google.samples.apps.nowinandroid.core.data.di
-import com.google.samples.apps.nowinandroid.core.data.di.DataModule
+import com.google.samples.apps.nowinandroid.core.data.repository.FakeNewsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.FakeRecentSearchRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.FakeSearchContentsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.FakeTopicsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.FakeUserDataRepository
import com.google.samples.apps.nowinandroid.core.data.repository.NewsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.RecentSearchRepository
import com.google.samples.apps.nowinandroid.core.data.repository.SearchContentsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.TopicsRepository
import com.google.samples.apps.nowinandroid.core.data.repository.UserDataRepository
-import com.google.samples.apps.nowinandroid.core.data.test.repository.FakeNewsRepository
-import com.google.samples.apps.nowinandroid.core.data.test.repository.FakeRecentSearchRepository
-import com.google.samples.apps.nowinandroid.core.data.test.repository.FakeSearchContentsRepository
-import com.google.samples.apps.nowinandroid.core.data.test.repository.FakeTopicsRepository
-import com.google.samples.apps.nowinandroid.core.data.test.repository.FakeUserDataRepository
+import com.google.samples.apps.nowinandroid.core.data.util.AlwaysOnlineNetworkMonitor
+import com.google.samples.apps.nowinandroid.core.data.util.DefaultZoneIdTimeZoneMonitor
import com.google.samples.apps.nowinandroid.core.data.util.NetworkMonitor
import com.google.samples.apps.nowinandroid.core.data.util.TimeZoneMonitor
import dagger.Binds
@@ -39,37 +40,25 @@ import dagger.hilt.testing.TestInstallIn
components = [SingletonComponent::class],
replaces = [DataModule::class],
)
-internal interface TestDataModule {
+interface TestDataModule {
@Binds
- fun bindsTopicRepository(
- fakeTopicsRepository: FakeTopicsRepository,
- ): TopicsRepository
+ fun bindsTopicRepository(it: FakeTopicsRepository): TopicsRepository
@Binds
- fun bindsNewsResourceRepository(
- fakeNewsRepository: FakeNewsRepository,
- ): NewsRepository
+ fun bindsNewsResourceRepository(it: FakeNewsRepository): NewsRepository
@Binds
- fun bindsUserDataRepository(
- userDataRepository: FakeUserDataRepository,
- ): UserDataRepository
+ fun bindsUserDataRepository(it: FakeUserDataRepository): UserDataRepository
@Binds
- fun bindsRecentSearchRepository(
- recentSearchRepository: FakeRecentSearchRepository,
- ): RecentSearchRepository
+ fun bindsRecentSearchRepository(it: FakeRecentSearchRepository): RecentSearchRepository
@Binds
- fun bindsSearchContentsRepository(
- searchContentsRepository: FakeSearchContentsRepository,
- ): SearchContentsRepository
+ fun bindsSearchContentsRepository(it: FakeSearchContentsRepository): SearchContentsRepository
@Binds
- fun bindsNetworkMonitor(
- networkMonitor: AlwaysOnlineNetworkMonitor,
- ): NetworkMonitor
+ fun bindsNetworkMonitor(it: AlwaysOnlineNetworkMonitor): NetworkMonitor
@Binds
- fun binds(impl: DefaultZoneIdTimeZoneMonitor): TimeZoneMonitor
+ fun bindsTimeZoneMonitor(it: DefaultZoneIdTimeZoneMonitor): TimeZoneMonitor
}
diff --git a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeNewsRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeNewsRepository.kt
similarity index 92%
rename from core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeNewsRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeNewsRepository.kt
index 0cdec60900..d356559aea 100644
--- a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeNewsRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeNewsRepository.kt
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.data.test.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
import com.google.samples.apps.nowinandroid.core.data.Synchronizer
import com.google.samples.apps.nowinandroid.core.data.model.asEntity
-import com.google.samples.apps.nowinandroid.core.data.repository.NewsRepository
-import com.google.samples.apps.nowinandroid.core.data.repository.NewsResourceQuery
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceEntity
import com.google.samples.apps.nowinandroid.core.database.model.asExternalModel
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
diff --git a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeRecentSearchRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeRecentSearchRepository.kt
similarity index 81%
rename from core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeRecentSearchRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeRecentSearchRepository.kt
index b8d949efed..38852483cb 100644
--- a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeRecentSearchRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeRecentSearchRepository.kt
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.data.test.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
import com.google.samples.apps.nowinandroid.core.data.model.RecentSearchQuery
-import com.google.samples.apps.nowinandroid.core.data.repository.RecentSearchRepository
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import javax.inject.Inject
@@ -25,7 +24,7 @@ import javax.inject.Inject
/**
* Fake implementation of the [RecentSearchRepository]
*/
-internal class FakeRecentSearchRepository @Inject constructor() : RecentSearchRepository {
+class FakeRecentSearchRepository @Inject constructor() : RecentSearchRepository {
override suspend fun insertOrReplaceRecentSearch(searchQuery: String) = Unit
override fun getRecentSearchQueries(limit: Int): Flow> =
diff --git a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeSearchContentsRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeSearchContentsRepository.kt
similarity index 80%
rename from core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeSearchContentsRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeSearchContentsRepository.kt
index 1feeb6dcc6..6d7101d69b 100644
--- a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeSearchContentsRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeSearchContentsRepository.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.data.test.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
-import com.google.samples.apps.nowinandroid.core.data.repository.SearchContentsRepository
import com.google.samples.apps.nowinandroid.core.model.data.SearchResult
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
@@ -25,7 +24,7 @@ import javax.inject.Inject
/**
* Fake implementation of the [SearchContentsRepository]
*/
-internal class FakeSearchContentsRepository @Inject constructor() : SearchContentsRepository {
+class FakeSearchContentsRepository @Inject constructor() : SearchContentsRepository {
override suspend fun populateFtsData() = Unit
override fun searchContents(searchQuery: String): Flow = flowOf()
diff --git a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeTopicsRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeTopicsRepository.kt
similarity index 91%
rename from core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeTopicsRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeTopicsRepository.kt
index 0b81dd3095..b0ee523cb1 100644
--- a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeTopicsRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeTopicsRepository.kt
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.data.test.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
import com.google.samples.apps.nowinandroid.core.data.Synchronizer
-import com.google.samples.apps.nowinandroid.core.data.repository.TopicsRepository
import com.google.samples.apps.nowinandroid.core.model.data.Topic
import com.google.samples.apps.nowinandroid.core.network.Dispatcher
import com.google.samples.apps.nowinandroid.core.network.NiaDispatchers.IO
@@ -36,7 +35,7 @@ import javax.inject.Inject
* This allows us to run the app with fake data, without needing an internet connection or working
* backend.
*/
-internal class FakeTopicsRepository @Inject constructor(
+class FakeTopicsRepository @Inject constructor(
@Dispatcher(IO) private val ioDispatcher: CoroutineDispatcher,
private val datasource: DemoNiaNetworkDataSource,
) : TopicsRepository {
diff --git a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeUserDataRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeUserDataRepository.kt
similarity index 94%
rename from core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeUserDataRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeUserDataRepository.kt
index 61ab422af8..dc81c94a36 100644
--- a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/repository/FakeUserDataRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/FakeUserDataRepository.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.data.test.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
-import com.google.samples.apps.nowinandroid.core.data.repository.UserDataRepository
import com.google.samples.apps.nowinandroid.core.datastore.NiaPreferencesDataSource
import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig
import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestNewsRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestNewsRepository.kt
similarity index 90%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestNewsRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestNewsRepository.kt
index ef065a9f8e..2e70b484b6 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestNewsRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestNewsRepository.kt
@@ -14,11 +14,9 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
import com.google.samples.apps.nowinandroid.core.data.Synchronizer
-import com.google.samples.apps.nowinandroid.core.data.repository.NewsRepository
-import com.google.samples.apps.nowinandroid.core.data.repository.NewsResourceQuery
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import com.google.samples.apps.nowinandroid.core.model.data.Topic
import kotlinx.coroutines.channels.BufferOverflow
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestRecentSearchRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestRecentSearchRepository.kt
similarity index 89%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestRecentSearchRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestRecentSearchRepository.kt
index f700bdc310..740ae86ade 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestRecentSearchRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestRecentSearchRepository.kt
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
import com.google.samples.apps.nowinandroid.core.data.model.RecentSearchQuery
-import com.google.samples.apps.nowinandroid.core.data.repository.RecentSearchRepository
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestSearchContentsRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestSearchContentsRepository.kt
similarity index 93%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestSearchContentsRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestSearchContentsRepository.kt
index 5436cd10f7..3b9d95ea7d 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestSearchContentsRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestSearchContentsRepository.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
-import com.google.samples.apps.nowinandroid.core.data.repository.SearchContentsRepository
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import com.google.samples.apps.nowinandroid.core.model.data.SearchResult
import com.google.samples.apps.nowinandroid.core.model.data.Topic
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestTopicsRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestTopicsRepository.kt
similarity index 91%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestTopicsRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestTopicsRepository.kt
index ddccbbe35e..52e034e09a 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestTopicsRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestTopicsRepository.kt
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
import com.google.samples.apps.nowinandroid.core.data.Synchronizer
-import com.google.samples.apps.nowinandroid.core.data.repository.TopicsRepository
import com.google.samples.apps.nowinandroid.core.model.data.Topic
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.Flow
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestUserDataRepository.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestUserDataRepository.kt
similarity index 96%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestUserDataRepository.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestUserDataRepository.kt
index be76112dc5..92eb21bc3b 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/repository/TestUserDataRepository.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/repository/TestUserDataRepository.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.repository
+package com.google.samples.apps.nowinandroid.core.data.repository
-import com.google.samples.apps.nowinandroid.core.data.repository.UserDataRepository
import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig
import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand
import com.google.samples.apps.nowinandroid.core.model.data.UserData
diff --git a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/AlwaysOnlineNetworkMonitor.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/AlwaysOnlineNetworkMonitor.kt
similarity index 86%
rename from core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/AlwaysOnlineNetworkMonitor.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/AlwaysOnlineNetworkMonitor.kt
index c00c99ded0..4e5b9363f6 100644
--- a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/AlwaysOnlineNetworkMonitor.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/AlwaysOnlineNetworkMonitor.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.data.test
+package com.google.samples.apps.nowinandroid.core.data.util
-import com.google.samples.apps.nowinandroid.core.data.util.NetworkMonitor
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import javax.inject.Inject
diff --git a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/DefaultZoneIdTimeZoneMonitor.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/DefaultZoneIdTimeZoneMonitor.kt
similarity index 87%
rename from core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/DefaultZoneIdTimeZoneMonitor.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/DefaultZoneIdTimeZoneMonitor.kt
index 5a21ae3375..6e48591a26 100644
--- a/core/data-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/data/test/DefaultZoneIdTimeZoneMonitor.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/DefaultZoneIdTimeZoneMonitor.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.data.test
+package com.google.samples.apps.nowinandroid.core.data.util
-import com.google.samples.apps.nowinandroid.core.data.util.TimeZoneMonitor
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.datetime.TimeZone
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestNetworkMonitor.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/TestNetworkMonitor.kt
similarity index 88%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestNetworkMonitor.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/TestNetworkMonitor.kt
index ef4b06b8a0..6b907e6e14 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestNetworkMonitor.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/TestNetworkMonitor.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.util
+package com.google.samples.apps.nowinandroid.core.data.util
-import com.google.samples.apps.nowinandroid.core.data.util.NetworkMonitor
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestSyncManager.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/TestSyncManager.kt
similarity index 89%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestSyncManager.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/TestSyncManager.kt
index ff1e2fdd99..5bab2cafe2 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestSyncManager.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/TestSyncManager.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.util
+package com.google.samples.apps.nowinandroid.core.data.util
-import com.google.samples.apps.nowinandroid.core.data.util.SyncManager
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestTimeZoneMonitor.kt b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/TestTimeZoneMonitor.kt
similarity index 89%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestTimeZoneMonitor.kt
rename to core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/TestTimeZoneMonitor.kt
index cc71ab2ca4..7169243f83 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/TestTimeZoneMonitor.kt
+++ b/core/data/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/data/util/TestTimeZoneMonitor.kt
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.util
+package com.google.samples.apps.nowinandroid.core.data.util
-import com.google.samples.apps.nowinandroid.core.data.util.TimeZoneMonitor
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.datetime.TimeZone
diff --git a/core/datastore-test/.gitignore b/core/datastore-test/.gitignore
deleted file mode 100644
index 42afabfd2a..0000000000
--- a/core/datastore-test/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/core/datastore-test/README.md b/core/datastore-test/README.md
deleted file mode 100644
index 99cf13f1f8..0000000000
--- a/core/datastore-test/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# :core:datastore-test module
-## Dependency graph
-![Dependency graph](../../docs/images/graphs/dep_graph_core_datastore_test.svg)
diff --git a/core/datastore-test/build.gradle.kts b/core/datastore-test/build.gradle.kts
deleted file mode 100644
index 53e5e2c0c5..0000000000
--- a/core/datastore-test/build.gradle.kts
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-plugins {
- alias(libs.plugins.nowinandroid.android.library)
- alias(libs.plugins.nowinandroid.android.hilt)
-}
-
-android {
- namespace = "com.google.samples.apps.nowinandroid.core.datastore.test"
-}
-
-dependencies {
- implementation(libs.hilt.android.testing)
- implementation(projects.core.common)
- implementation(projects.core.datastore)
-}
diff --git a/core/datastore-test/src/main/AndroidManifest.xml b/core/datastore-test/src/main/AndroidManifest.xml
deleted file mode 100644
index 51d0cfc2e0..0000000000
--- a/core/datastore-test/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/core/datastore/build.gradle.kts b/core/datastore/build.gradle.kts
index 34ea5ee78b..3059b6a5b7 100644
--- a/core/datastore/build.gradle.kts
+++ b/core/datastore/build.gradle.kts
@@ -30,6 +30,7 @@ android {
isReturnDefaultValues = true
}
}
+ testFixtures.enable = true
}
dependencies {
@@ -39,6 +40,10 @@ dependencies {
implementation(projects.core.common)
- testImplementation(projects.core.datastoreTest)
testImplementation(libs.kotlinx.coroutines.test)
+
+ kspTestFixtures(libs.hilt.compiler)
+ testFixturesImplementation(libs.hilt.android.testing)
+ testFixturesImplementation(projects.core.common)
+ testFixturesImplementation(projects.core.datastore)
}
diff --git a/core/datastore/src/test/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt b/core/datastore/src/test/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt
index 433812808f..04335d833c 100644
--- a/core/datastore/src/test/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt
+++ b/core/datastore/src/test/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt
@@ -16,7 +16,7 @@
package com.google.samples.apps.nowinandroid.core.datastore
-import com.google.samples.apps.nowinandroid.core.datastore.test.testUserPreferencesDataStore
+import com.google.samples.apps.nowinandroid.core.datastore.di.testUserPreferencesDataStore
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.UnconfinedTestDispatcher
diff --git a/core/datastore-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/datastore/test/TestDataStoreModule.kt b/core/datastore/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/datastore/di/TestDataStoreModule.kt
similarity index 91%
rename from core/datastore-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/datastore/test/TestDataStoreModule.kt
rename to core/datastore/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/datastore/di/TestDataStoreModule.kt
index 295b2978a3..2dc673d0da 100644
--- a/core/datastore-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/datastore/test/TestDataStoreModule.kt
+++ b/core/datastore/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/datastore/di/TestDataStoreModule.kt
@@ -14,13 +14,12 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.datastore.test
+package com.google.samples.apps.nowinandroid.core.datastore.di
import androidx.datastore.core.DataStore
import androidx.datastore.core.DataStoreFactory
import com.google.samples.apps.nowinandroid.core.datastore.UserPreferences
import com.google.samples.apps.nowinandroid.core.datastore.UserPreferencesSerializer
-import com.google.samples.apps.nowinandroid.core.datastore.di.DataStoreModule
import com.google.samples.apps.nowinandroid.core.network.di.ApplicationScope
import dagger.Module
import dagger.Provides
@@ -35,7 +34,7 @@ import javax.inject.Singleton
components = [SingletonComponent::class],
replaces = [DataStoreModule::class],
)
-internal object TestDataStoreModule {
+object TestDataStoreModule {
@Provides
@Singleton
diff --git a/core/domain/build.gradle.kts b/core/domain/build.gradle.kts
index 1918774597..27c496e2d7 100644
--- a/core/domain/build.gradle.kts
+++ b/core/domain/build.gradle.kts
@@ -30,4 +30,5 @@ dependencies {
implementation(libs.javax.inject)
testImplementation(projects.core.testing)
+ testImplementation(testFixtures(projects.core.data))
}
\ No newline at end of file
diff --git a/core/domain/src/test/kotlin/com/google/samples/apps/nowinandroid/core/domain/GetFollowableTopicsUseCaseTest.kt b/core/domain/src/test/kotlin/com/google/samples/apps/nowinandroid/core/domain/GetFollowableTopicsUseCaseTest.kt
index 42a31f8580..76b94aa37e 100644
--- a/core/domain/src/test/kotlin/com/google/samples/apps/nowinandroid/core/domain/GetFollowableTopicsUseCaseTest.kt
+++ b/core/domain/src/test/kotlin/com/google/samples/apps/nowinandroid/core/domain/GetFollowableTopicsUseCaseTest.kt
@@ -16,11 +16,11 @@
package com.google.samples.apps.nowinandroid.core.domain
+import com.google.samples.apps.nowinandroid.core.data.repository.TestTopicsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestUserDataRepository
import com.google.samples.apps.nowinandroid.core.domain.TopicSortField.NAME
import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic
import com.google.samples.apps.nowinandroid.core.model.data.Topic
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestTopicsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
import com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRule
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest
diff --git a/core/model/build.gradle.kts b/core/model/build.gradle.kts
index 5d6cabfdf7..f9c645fcaa 100644
--- a/core/model/build.gradle.kts
+++ b/core/model/build.gradle.kts
@@ -16,6 +16,7 @@
plugins {
alias(libs.plugins.nowinandroid.jvm.library)
+ `java-test-fixtures`
}
dependencies {
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/FollowableTopicTestData.kt b/core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/FollowableTopicFixtures.kt
similarity index 93%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/FollowableTopicTestData.kt
rename to core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/FollowableTopicFixtures.kt
index 9b85516e77..5552389dfa 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/FollowableTopicTestData.kt
+++ b/core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/FollowableTopicFixtures.kt
@@ -16,10 +16,7 @@
@file:Suppress("ktlint:standard:max-line-length")
-package com.google.samples.apps.nowinandroid.core.testing.data
-
-import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic
-import com.google.samples.apps.nowinandroid.core.model.data.Topic
+package com.google.samples.apps.nowinandroid.core.model.data
val followableTopicTestData: List = listOf(
FollowableTopic(
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/NewsResourcesTestData.kt b/core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/NewsResourceFixtures.kt
similarity index 96%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/NewsResourcesTestData.kt
rename to core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/NewsResourceFixtures.kt
index b3fff7ca04..f4ad4e2d1a 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/NewsResourcesTestData.kt
+++ b/core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/NewsResourceFixtures.kt
@@ -16,9 +16,8 @@
@file:Suppress("ktlint:standard:max-line-length")
-package com.google.samples.apps.nowinandroid.core.testing.data
+package com.google.samples.apps.nowinandroid.core.model.data
-import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import kotlinx.datetime.Instant
val newsResourcesTestData: List = listOf(
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/TopicsTestData.kt b/core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/TopicFixtures.kt
similarity index 95%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/TopicsTestData.kt
rename to core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/TopicFixtures.kt
index fc6ef62a60..37a0c96ba7 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/TopicsTestData.kt
+++ b/core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/TopicFixtures.kt
@@ -16,9 +16,7 @@
@file:Suppress("ktlint:standard:max-line-length")
-package com.google.samples.apps.nowinandroid.core.testing.data
-
-import com.google.samples.apps.nowinandroid.core.model.data.Topic
+package com.google.samples.apps.nowinandroid.core.model.data
val topicsTestData: List = listOf(
Topic(
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/UserNewsResourcesTestData.kt b/core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/UserNewsResourceFixtures.kt
similarity index 92%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/UserNewsResourcesTestData.kt
rename to core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/UserNewsResourceFixtures.kt
index 4174391df7..56e25f271f 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/data/UserNewsResourcesTestData.kt
+++ b/core/model/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/model/data/UserNewsResourceFixtures.kt
@@ -16,13 +16,8 @@
@file:Suppress("ktlint:standard:max-line-length")
-package com.google.samples.apps.nowinandroid.core.testing.data
+package com.google.samples.apps.nowinandroid.core.model.data
-import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig
-import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
-import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand
-import com.google.samples.apps.nowinandroid.core.model.data.UserData
-import com.google.samples.apps.nowinandroid.core.model.data.UserNewsResource
import kotlinx.datetime.Instant
import kotlinx.datetime.LocalDateTime
import kotlinx.datetime.TimeZone
diff --git a/core/notifications/build.gradle.kts b/core/notifications/build.gradle.kts
index 92871b72be..616c03ce99 100644
--- a/core/notifications/build.gradle.kts
+++ b/core/notifications/build.gradle.kts
@@ -20,6 +20,7 @@ plugins {
android {
namespace = "com.google.samples.apps.nowinandroid.core.notifications"
+ testFixtures.enable = true
}
dependencies {
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/notifications/TestNotifier.kt b/core/notifications/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/notifications/TestNotifier.kt
similarity index 88%
rename from core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/notifications/TestNotifier.kt
rename to core/notifications/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/notifications/TestNotifier.kt
index d57c4ed754..5372610aba 100644
--- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/notifications/TestNotifier.kt
+++ b/core/notifications/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/notifications/TestNotifier.kt
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.testing.notifications
+package com.google.samples.apps.nowinandroid.core.notifications
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
-import com.google.samples.apps.nowinandroid.core.notifications.Notifier
/**
* Aggregates news resources that have been notified for addition
diff --git a/core/testing/build.gradle.kts b/core/testing/build.gradle.kts
index 02729ceffc..338432cdcd 100644
--- a/core/testing/build.gradle.kts
+++ b/core/testing/build.gradle.kts
@@ -39,4 +39,7 @@ dependencies {
implementation(libs.kotlinx.datetime)
implementation(projects.core.common)
implementation(projects.core.designsystem)
+ implementation(testFixtures(projects.core.data))
+ implementation(testFixtures(projects.core.datastore))
+ implementation(testFixtures(projects.sync))
}
diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/di/TestingModule.kt b/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/di/TestingModule.kt
new file mode 100644
index 0000000000..528e396a68
--- /dev/null
+++ b/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/di/TestingModule.kt
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.samples.apps.nowinandroid.core.testing.di
+
+import androidx.datastore.core.DataStore
+import com.google.samples.apps.nowinandroid.core.data.di.DataModule
+import com.google.samples.apps.nowinandroid.core.data.di.TestDataModule
+import com.google.samples.apps.nowinandroid.core.datastore.UserPreferences
+import com.google.samples.apps.nowinandroid.core.datastore.UserPreferencesSerializer
+import com.google.samples.apps.nowinandroid.core.datastore.di.DataStoreModule
+import com.google.samples.apps.nowinandroid.core.datastore.di.TestDataStoreModule
+import com.google.samples.apps.nowinandroid.core.network.di.ApplicationScope
+import com.google.samples.apps.nowinandroid.core.sync.di.TestSyncModule
+import com.google.samples.apps.nowinandroid.sync.di.SyncModule
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.components.SingletonComponent
+import dagger.hilt.testing.TestInstallIn
+import kotlinx.coroutines.CoroutineScope
+import org.junit.rules.TemporaryFolder
+import javax.inject.Singleton
+
+/**
+ * KSP is currently not supported on Android testFixtures ([issuetracker](https://issuetracker.google.com/issues/259523353#comment32)).
+ *
+ * Including [TestDataStoreModule] in [Module.includes] leads to an unexpected compilation error (maybe due to datastore-proto and KSP ordering, certainly related to the initial issue).
+ *
+ * ```
+ * > Task :app:hiltJavaCompileDemoDebugAndroidTest FAILED
+ * nowinandroid\app\build\generated\hilt\component_sources\demoDebugAndroidTest\dagger\hilt\android\internal\testing\root\DaggerNavigationTest_HiltComponents_SingletonC.java:38: error: cannot find symbol
+ * import com.google.samples.apps.nowinandroid.core.datastore.di.TestDataStoreModule_ProvidesUserPreferencesDataStoreFactory;
+ * ^
+ * symbol: class TestDataStoreModule_ProvidesUserPreferencesDataStoreFactory
+ * location: package com.google.samples.apps.nowinandroid.core.datastore.di
+ * ```
+ *
+ * Therefore, a [providesUserPreferencesDataStore] delegate is added in this module.
+ */
+@Module(includes = [TestDataModule::class, TestSyncModule::class])
+@TestInstallIn(
+ components = [SingletonComponent::class],
+ replaces = [DataModule::class, SyncModule::class, DataStoreModule::class],
+)
+internal object TestingModule {
+ @Provides
+ @Singleton
+ fun providesUserPreferencesDataStore(
+ @ApplicationScope scope: CoroutineScope,
+ userPreferencesSerializer: UserPreferencesSerializer,
+ tmpFolder: TemporaryFolder,
+ ): DataStore = TestDataStoreModule.providesUserPreferencesDataStore(
+ scope,
+ userPreferencesSerializer,
+ tmpFolder,
+ )
+}
diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts
index 5d8a65d449..944ac151a3 100644
--- a/core/ui/build.gradle.kts
+++ b/core/ui/build.gradle.kts
@@ -37,4 +37,5 @@ dependencies {
implementation(libs.coil.kt.compose)
androidTestImplementation(projects.core.testing)
+ androidTestImplementation(testFixtures(projects.core.model))
}
diff --git a/core/ui/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsResourceCardTest.kt b/core/ui/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsResourceCardTest.kt
index d0a1243162..76b785368b 100644
--- a/core/ui/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsResourceCardTest.kt
+++ b/core/ui/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/core/ui/NewsResourceCardTest.kt
@@ -22,8 +22,8 @@ import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
-import com.google.samples.apps.nowinandroid.core.testing.data.followableTopicTestData
-import com.google.samples.apps.nowinandroid.core.testing.data.userNewsResourcesTestData
+import com.google.samples.apps.nowinandroid.core.model.data.followableTopicTestData
+import com.google.samples.apps.nowinandroid.core.model.data.userNewsResourcesTestData
import org.junit.Rule
import org.junit.Test
diff --git a/docs/images/graphs/dep_graph_core_data_test.svg b/docs/images/graphs/dep_graph_core_data_test.svg
deleted file mode 100644
index 798696c117..0000000000
--- a/docs/images/graphs/dep_graph_core_data_test.svg
+++ /dev/null
@@ -1,133 +0,0 @@
-
-
-
diff --git a/docs/images/graphs/dep_graph_core_datastore_test.svg b/docs/images/graphs/dep_graph_core_datastore_test.svg
deleted file mode 100644
index e42e5e795e..0000000000
--- a/docs/images/graphs/dep_graph_core_datastore_test.svg
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
diff --git a/docs/images/graphs/dep_graph_sync_sync_test.svg b/docs/images/graphs/dep_graph_sync_sync_test.svg
deleted file mode 100644
index 58a31af19c..0000000000
--- a/docs/images/graphs/dep_graph_sync_sync_test.svg
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
-
diff --git a/docs/images/graphs/dep_graph_sync_work.svg b/docs/images/graphs/dep_graph_sync_work.svg
deleted file mode 100644
index 2581a10ae1..0000000000
--- a/docs/images/graphs/dep_graph_sync_work.svg
+++ /dev/null
@@ -1,138 +0,0 @@
-
-
-
diff --git a/feature/bookmarks/build.gradle.kts b/feature/bookmarks/build.gradle.kts
index 4e97176a2c..376324ba0d 100644
--- a/feature/bookmarks/build.gradle.kts
+++ b/feature/bookmarks/build.gradle.kts
@@ -28,6 +28,9 @@ dependencies {
implementation(projects.core.data)
testImplementation(projects.core.testing)
+ testImplementation(testFixtures(projects.core.data))
+ testImplementation(testFixtures(projects.core.model))
androidTestImplementation(projects.core.testing)
+ androidTestImplementation(testFixtures(projects.core.model))
}
diff --git a/feature/bookmarks/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksScreenTest.kt b/feature/bookmarks/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksScreenTest.kt
index 40f54e4a77..637554cdee 100644
--- a/feature/bookmarks/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksScreenTest.kt
+++ b/feature/bookmarks/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksScreenTest.kt
@@ -34,7 +34,7 @@ import androidx.compose.ui.test.performClick
import androidx.compose.ui.test.performScrollToNode
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.testing.TestLifecycleOwner
-import com.google.samples.apps.nowinandroid.core.testing.data.userNewsResourcesTestData
+import com.google.samples.apps.nowinandroid.core.model.data.userNewsResourcesTestData
import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState
import kotlinx.coroutines.test.runTest
import org.junit.Rule
diff --git a/feature/bookmarks/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksViewModelTest.kt b/feature/bookmarks/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksViewModelTest.kt
index 037e9db647..a33ca44ffa 100644
--- a/feature/bookmarks/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksViewModelTest.kt
+++ b/feature/bookmarks/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/bookmarks/BookmarksViewModelTest.kt
@@ -17,9 +17,9 @@
package com.google.samples.apps.nowinandroid.feature.bookmarks
import com.google.samples.apps.nowinandroid.core.data.repository.CompositeUserNewsResourceRepository
-import com.google.samples.apps.nowinandroid.core.testing.data.newsResourcesTestData
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestNewsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestNewsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestUserDataRepository
+import com.google.samples.apps.nowinandroid.core.model.data.newsResourcesTestData
import com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRule
import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState.Loading
import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState.Success
diff --git a/feature/foryou/build.gradle.kts b/feature/foryou/build.gradle.kts
index fd41d9a13a..91e2f5b4f0 100644
--- a/feature/foryou/build.gradle.kts
+++ b/feature/foryou/build.gradle.kts
@@ -34,7 +34,10 @@ dependencies {
testImplementation(libs.robolectric)
testImplementation(projects.core.testing)
testImplementation(projects.core.screenshotTesting)
+ testImplementation(testFixtures(projects.core.data))
+ testImplementation(testFixtures(projects.core.analytics))
testDemoImplementation(libs.roborazzi)
androidTestImplementation(projects.core.testing)
+ androidTestImplementation(testFixtures(projects.core.model))
}
diff --git a/feature/foryou/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenTest.kt b/feature/foryou/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenTest.kt
index 5477493ef9..895acd6e4c 100644
--- a/feature/foryou/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenTest.kt
+++ b/feature/foryou/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreenTest.kt
@@ -28,9 +28,9 @@ import androidx.compose.ui.test.onFirst
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performScrollToNode
+import com.google.samples.apps.nowinandroid.core.model.data.followableTopicTestData
+import com.google.samples.apps.nowinandroid.core.model.data.userNewsResourcesTestData
import com.google.samples.apps.nowinandroid.core.rules.GrantPostNotificationsPermissionRule
-import com.google.samples.apps.nowinandroid.core.testing.data.followableTopicTestData
-import com.google.samples.apps.nowinandroid.core.testing.data.userNewsResourcesTestData
import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState
import org.junit.Rule
import org.junit.Test
diff --git a/feature/foryou/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModelTest.kt b/feature/foryou/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModelTest.kt
index 2fbdf0a790..85d1205150 100644
--- a/feature/foryou/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModelTest.kt
+++ b/feature/foryou/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/ForYouViewModelTest.kt
@@ -19,20 +19,20 @@ package com.google.samples.apps.nowinandroid.feature.foryou
import androidx.lifecycle.SavedStateHandle
import com.google.samples.apps.nowinandroid.core.analytics.AnalyticsEvent
import com.google.samples.apps.nowinandroid.core.analytics.AnalyticsEvent.Param
+import com.google.samples.apps.nowinandroid.core.analytics.TestAnalyticsHelper
import com.google.samples.apps.nowinandroid.core.data.repository.CompositeUserNewsResourceRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestNewsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestTopicsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestUserDataRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.emptyUserData
+import com.google.samples.apps.nowinandroid.core.data.util.TestSyncManager
import com.google.samples.apps.nowinandroid.core.domain.GetFollowableTopicsUseCase
import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import com.google.samples.apps.nowinandroid.core.model.data.Topic
import com.google.samples.apps.nowinandroid.core.model.data.UserNewsResource
import com.google.samples.apps.nowinandroid.core.model.data.mapToUserNewsResources
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestNewsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestTopicsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.emptyUserData
import com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRule
-import com.google.samples.apps.nowinandroid.core.testing.util.TestAnalyticsHelper
-import com.google.samples.apps.nowinandroid.core.testing.util.TestSyncManager
import com.google.samples.apps.nowinandroid.core.ui.NewsFeedUiState
import com.google.samples.apps.nowinandroid.feature.foryou.navigation.LINKED_NEWS_RESOURCE_ID
import kotlinx.coroutines.flow.collect
diff --git a/feature/interests/build.gradle.kts b/feature/interests/build.gradle.kts
index ee6aaf122d..8439a310cd 100644
--- a/feature/interests/build.gradle.kts
+++ b/feature/interests/build.gradle.kts
@@ -28,6 +28,8 @@ dependencies {
implementation(projects.core.domain)
testImplementation(projects.core.testing)
+ testImplementation(testFixtures(projects.core.data))
androidTestImplementation(projects.core.testing)
+ androidTestImplementation(testFixtures(projects.core.model))
}
diff --git a/feature/interests/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsScreenTest.kt b/feature/interests/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsScreenTest.kt
index a441f5a9d8..5935136f13 100644
--- a/feature/interests/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsScreenTest.kt
+++ b/feature/interests/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsScreenTest.kt
@@ -24,7 +24,7 @@ import androidx.compose.ui.test.junit4.createAndroidComposeRule
import androidx.compose.ui.test.onAllNodesWithContentDescription
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
-import com.google.samples.apps.nowinandroid.core.testing.data.followableTopicTestData
+import com.google.samples.apps.nowinandroid.core.model.data.followableTopicTestData
import com.google.samples.apps.nowinandroid.feature.interests.InterestsScreen
import com.google.samples.apps.nowinandroid.feature.interests.InterestsUiState
import org.junit.Before
diff --git a/feature/interests/src/test/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsViewModelTest.kt b/feature/interests/src/test/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsViewModelTest.kt
index 63d3c49b70..01534f3096 100644
--- a/feature/interests/src/test/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsViewModelTest.kt
+++ b/feature/interests/src/test/kotlin/com/google/samples/apps/nowinandroid/interests/InterestsViewModelTest.kt
@@ -17,11 +17,11 @@
package com.google.samples.apps.nowinandroid.interests
import androidx.lifecycle.SavedStateHandle
+import com.google.samples.apps.nowinandroid.core.data.repository.TestTopicsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestUserDataRepository
import com.google.samples.apps.nowinandroid.core.domain.GetFollowableTopicsUseCase
import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic
import com.google.samples.apps.nowinandroid.core.model.data.Topic
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestTopicsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
import com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRule
import com.google.samples.apps.nowinandroid.feature.interests.InterestsUiState
import com.google.samples.apps.nowinandroid.feature.interests.InterestsViewModel
diff --git a/feature/search/build.gradle.kts b/feature/search/build.gradle.kts
index 98052e9ab5..f694c3b765 100644
--- a/feature/search/build.gradle.kts
+++ b/feature/search/build.gradle.kts
@@ -30,7 +30,10 @@ dependencies {
implementation(projects.core.ui)
testImplementation(projects.core.testing)
+ testImplementation(testFixtures(projects.core.data))
+ testImplementation(testFixtures(projects.core.model))
androidTestImplementation(projects.core.testing)
+ androidTestImplementation(testFixtures(projects.core.model))
}
diff --git a/feature/search/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/search/SearchScreenTest.kt b/feature/search/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/search/SearchScreenTest.kt
index a9e2fa98fd..a4db6332e3 100644
--- a/feature/search/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/search/SearchScreenTest.kt
+++ b/feature/search/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/search/SearchScreenTest.kt
@@ -33,8 +33,8 @@ import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig.DARK
import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand.ANDROID
import com.google.samples.apps.nowinandroid.core.model.data.UserData
import com.google.samples.apps.nowinandroid.core.model.data.UserNewsResource
-import com.google.samples.apps.nowinandroid.core.testing.data.followableTopicTestData
-import com.google.samples.apps.nowinandroid.core.testing.data.newsResourcesTestData
+import com.google.samples.apps.nowinandroid.core.model.data.followableTopicTestData
+import com.google.samples.apps.nowinandroid.core.model.data.newsResourcesTestData
import com.google.samples.apps.nowinandroid.core.ui.R.string
import org.junit.Before
import org.junit.Rule
diff --git a/feature/search/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/search/SearchViewModelTest.kt b/feature/search/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/search/SearchViewModelTest.kt
index c832401deb..631c666fe5 100644
--- a/feature/search/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/search/SearchViewModelTest.kt
+++ b/feature/search/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/search/SearchViewModelTest.kt
@@ -18,14 +18,14 @@ package com.google.samples.apps.nowinandroid.feature.search
import androidx.lifecycle.SavedStateHandle
import com.google.samples.apps.nowinandroid.core.analytics.NoOpAnalyticsHelper
+import com.google.samples.apps.nowinandroid.core.data.repository.TestRecentSearchRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestSearchContentsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestUserDataRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.emptyUserData
import com.google.samples.apps.nowinandroid.core.domain.GetRecentSearchQueriesUseCase
import com.google.samples.apps.nowinandroid.core.domain.GetSearchContentsUseCase
-import com.google.samples.apps.nowinandroid.core.testing.data.newsResourcesTestData
-import com.google.samples.apps.nowinandroid.core.testing.data.topicsTestData
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestRecentSearchRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestSearchContentsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.emptyUserData
+import com.google.samples.apps.nowinandroid.core.model.data.newsResourcesTestData
+import com.google.samples.apps.nowinandroid.core.model.data.topicsTestData
import com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRule
import com.google.samples.apps.nowinandroid.feature.search.RecentSearchQueriesUiState.Success
import com.google.samples.apps.nowinandroid.feature.search.SearchResultUiState.EmptyQuery
diff --git a/feature/settings/build.gradle.kts b/feature/settings/build.gradle.kts
index 4b9a72bdd0..563cba6625 100644
--- a/feature/settings/build.gradle.kts
+++ b/feature/settings/build.gradle.kts
@@ -30,6 +30,7 @@ dependencies {
implementation(projects.core.data)
testImplementation(projects.core.testing)
+ testImplementation(testFixtures(projects.core.data))
androidTestImplementation(projects.core.testing)
}
diff --git a/feature/settings/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModelTest.kt b/feature/settings/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModelTest.kt
index 9062abee65..25e9d6f99d 100644
--- a/feature/settings/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModelTest.kt
+++ b/feature/settings/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/settings/SettingsViewModelTest.kt
@@ -16,9 +16,9 @@
package com.google.samples.apps.nowinandroid.feature.settings
+import com.google.samples.apps.nowinandroid.core.data.repository.TestUserDataRepository
import com.google.samples.apps.nowinandroid.core.model.data.DarkThemeConfig.DARK
import com.google.samples.apps.nowinandroid.core.model.data.ThemeBrand.ANDROID
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
import com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRule
import com.google.samples.apps.nowinandroid.feature.settings.SettingsUiState.Loading
import com.google.samples.apps.nowinandroid.feature.settings.SettingsUiState.Success
diff --git a/feature/topic/build.gradle.kts b/feature/topic/build.gradle.kts
index d457b2f732..9fd3daaac7 100644
--- a/feature/topic/build.gradle.kts
+++ b/feature/topic/build.gradle.kts
@@ -28,6 +28,8 @@ dependencies {
implementation(projects.core.data)
testImplementation(projects.core.testing)
+ testImplementation(testFixtures(projects.core.data))
androidTestImplementation(projects.core.testing)
+ androidTestImplementation(testFixtures(projects.core.model))
}
\ No newline at end of file
diff --git a/feature/topic/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt b/feature/topic/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt
index 2b87baf9e8..f2e661fd38 100644
--- a/feature/topic/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt
+++ b/feature/topic/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicScreenTest.kt
@@ -24,8 +24,8 @@ import androidx.compose.ui.test.onFirst
import androidx.compose.ui.test.onNodeWithContentDescription
import androidx.compose.ui.test.onNodeWithText
import androidx.compose.ui.test.performScrollToNode
-import com.google.samples.apps.nowinandroid.core.testing.data.followableTopicTestData
-import com.google.samples.apps.nowinandroid.core.testing.data.userNewsResourcesTestData
+import com.google.samples.apps.nowinandroid.core.model.data.followableTopicTestData
+import com.google.samples.apps.nowinandroid.core.model.data.userNewsResourcesTestData
import org.junit.Before
import org.junit.Rule
import org.junit.Test
diff --git a/feature/topic/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModelTest.kt b/feature/topic/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModelTest.kt
index 565732f596..fd42aa880c 100644
--- a/feature/topic/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModelTest.kt
+++ b/feature/topic/src/test/kotlin/com/google/samples/apps/nowinandroid/feature/topic/TopicViewModelTest.kt
@@ -18,12 +18,12 @@ package com.google.samples.apps.nowinandroid.feature.topic
import androidx.lifecycle.SavedStateHandle
import com.google.samples.apps.nowinandroid.core.data.repository.CompositeUserNewsResourceRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestNewsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestTopicsRepository
+import com.google.samples.apps.nowinandroid.core.data.repository.TestUserDataRepository
import com.google.samples.apps.nowinandroid.core.model.data.FollowableTopic
import com.google.samples.apps.nowinandroid.core.model.data.NewsResource
import com.google.samples.apps.nowinandroid.core.model.data.Topic
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestNewsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestTopicsRepository
-import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
import com.google.samples.apps.nowinandroid.core.testing.util.MainDispatcherRule
import com.google.samples.apps.nowinandroid.feature.topic.navigation.TOPIC_ID_ARG
import kotlinx.coroutines.flow.collect
diff --git a/gradle.properties b/gradle.properties
index 97f940e2e8..af23bfbb03 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -40,5 +40,9 @@ kotlin.code.style=official
android.defaults.buildfeatures.resvalues=false
android.defaults.buildfeatures.shaders=false
+# Android Test Fixtures
+android.experimental.enableTestFixturesKotlinSupport=true
+android.suppressUnsupportedOptionWarnings=android.suppressUnsupportedOptionWarnings,android.experimental.enableTestFixturesKotlinSupport
+
# Run Roborazzi screenshot tests with the local tests
roborazzi.test.verify=true
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index e0b938e75a..4b785dcf8e 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -2,7 +2,7 @@
accompanist = "0.34.0"
androidDesugarJdkLibs = "2.0.4"
# AGP and tools should be updated together
-androidGradlePlugin = "8.4.0"
+androidGradlePlugin = "8.5.0"
androidTools = "31.4.0"
androidxActivity = "1.8.2"
androidxAppCompat = "1.6.1"
diff --git a/settings.gradle.kts b/settings.gradle.kts
index d4b6654b17..0fcfee0659 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -39,11 +39,9 @@ include(":benchmarks")
include(":core:analytics")
include(":core:common")
include(":core:data")
-include(":core:data-test")
include(":core:database")
include(":core:datastore")
include(":core:datastore-proto")
-include(":core:datastore-test")
include(":core:designsystem")
include(":core:domain")
include(":core:model")
@@ -60,7 +58,6 @@ include(":feature:topic")
include(":feature:search")
include(":feature:settings")
include(":lint")
-include(":sync:work")
-include(":sync:sync-test")
+include(":sync")
include(":ui-test-hilt-manifest")
diff --git a/core/data-test/.gitignore b/sync/.gitignore
similarity index 100%
rename from core/data-test/.gitignore
rename to sync/.gitignore
diff --git a/sync/work/README.md b/sync/README.md
similarity index 100%
rename from sync/work/README.md
rename to sync/README.md
diff --git a/sync/work/build.gradle.kts b/sync/build.gradle.kts
similarity index 89%
rename from sync/work/build.gradle.kts
rename to sync/build.gradle.kts
index 7e61c73898..053a0ec9ad 100644
--- a/sync/work/build.gradle.kts
+++ b/sync/build.gradle.kts
@@ -23,6 +23,7 @@ android {
defaultConfig {
testInstrumentationRunner = "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner"
}
+ testFixtures.enable = true
namespace = "com.google.samples.apps.nowinandroid.sync"
}
@@ -42,4 +43,8 @@ dependencies {
androidTestImplementation(libs.hilt.android.testing)
androidTestImplementation(libs.kotlinx.coroutines.guava)
androidTestImplementation(projects.core.testing)
+
+ kspTestFixtures(libs.hilt.compiler)
+ testFixturesImplementation(libs.hilt.android.testing)
+ testFixturesImplementation(projects.core.data)
}
diff --git a/sync/work/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt b/sync/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt
similarity index 92%
rename from sync/work/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt
rename to sync/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt
index 9c9d135104..ad0a294698 100644
--- a/sync/work/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt
+++ b/sync/src/androidTest/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorkerTest.kt
@@ -23,11 +23,13 @@ import androidx.work.WorkInfo
import androidx.work.WorkManager
import androidx.work.testing.SynchronousExecutor
import androidx.work.testing.WorkManagerTestInitHelper
+import dagger.hilt.android.testing.BindValue
import dagger.hilt.android.testing.HiltAndroidRule
import dagger.hilt.android.testing.HiltAndroidTest
import org.junit.Before
import org.junit.Rule
import org.junit.Test
+import org.junit.rules.TemporaryFolder
import kotlin.test.assertEquals
@HiltAndroidTest
@@ -36,6 +38,10 @@ class SyncWorkerTest {
@get:Rule(order = 0)
val hiltRule = HiltAndroidRule(this)
+ @BindValue
+ @get:Rule(order = 1)
+ val tmpFolder: TemporaryFolder = TemporaryFolder.builder().assureDeletion().build()
+
private val context get() = InstrumentationRegistry.getInstrumentation().context
@Before
diff --git a/sync/work/src/demo/kotlin/com/google/samples/apps/nowinandroid/sync/di/SyncModule.kt b/sync/src/demo/kotlin/com/google/samples/apps/nowinandroid/sync/di/SyncModule.kt
similarity index 100%
rename from sync/work/src/demo/kotlin/com/google/samples/apps/nowinandroid/sync/di/SyncModule.kt
rename to sync/src/demo/kotlin/com/google/samples/apps/nowinandroid/sync/di/SyncModule.kt
diff --git a/sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/initializers/SyncInitializer.kt b/sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/initializers/SyncInitializer.kt
similarity index 100%
rename from sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/initializers/SyncInitializer.kt
rename to sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/initializers/SyncInitializer.kt
diff --git a/sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/initializers/SyncWorkHelpers.kt b/sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/initializers/SyncWorkHelpers.kt
similarity index 100%
rename from sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/initializers/SyncWorkHelpers.kt
rename to sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/initializers/SyncWorkHelpers.kt
diff --git a/sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/StubSyncSubscriber.kt b/sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/StubSyncSubscriber.kt
similarity index 100%
rename from sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/StubSyncSubscriber.kt
rename to sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/StubSyncSubscriber.kt
diff --git a/sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/SyncSubscriber.kt b/sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/SyncSubscriber.kt
similarity index 100%
rename from sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/SyncSubscriber.kt
rename to sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/SyncSubscriber.kt
diff --git a/sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/WorkManagerSyncManager.kt b/sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/WorkManagerSyncManager.kt
similarity index 100%
rename from sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/WorkManagerSyncManager.kt
rename to sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/status/WorkManagerSyncManager.kt
diff --git a/sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/AnalyticsExtensions.kt b/sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/AnalyticsExtensions.kt
similarity index 100%
rename from sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/AnalyticsExtensions.kt
rename to sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/AnalyticsExtensions.kt
diff --git a/sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/DelegatingWorker.kt b/sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/DelegatingWorker.kt
similarity index 100%
rename from sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/DelegatingWorker.kt
rename to sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/DelegatingWorker.kt
diff --git a/sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorker.kt b/sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorker.kt
similarity index 100%
rename from sync/work/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorker.kt
rename to sync/src/main/kotlin/com/google/samples/apps/nowinandroid/sync/workers/SyncWorker.kt
diff --git a/sync/work/src/main/res/values/strings.xml b/sync/src/main/res/values/strings.xml
similarity index 100%
rename from sync/work/src/main/res/values/strings.xml
rename to sync/src/main/res/values/strings.xml
diff --git a/sync/work/src/prod/AndroidManifest.xml b/sync/src/prod/AndroidManifest.xml
similarity index 100%
rename from sync/work/src/prod/AndroidManifest.xml
rename to sync/src/prod/AndroidManifest.xml
diff --git a/sync/work/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/di/SyncModule.kt b/sync/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/di/SyncModule.kt
similarity index 100%
rename from sync/work/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/di/SyncModule.kt
rename to sync/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/di/SyncModule.kt
diff --git a/sync/work/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/services/SyncNotificationsService.kt b/sync/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/services/SyncNotificationsService.kt
similarity index 100%
rename from sync/work/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/services/SyncNotificationsService.kt
rename to sync/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/services/SyncNotificationsService.kt
diff --git a/sync/work/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/status/FirebaseSyncSubscriber.kt b/sync/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/status/FirebaseSyncSubscriber.kt
similarity index 100%
rename from sync/work/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/status/FirebaseSyncSubscriber.kt
rename to sync/src/prod/kotlin/com/google/samples/apps/nowinandroid/sync/status/FirebaseSyncSubscriber.kt
diff --git a/sync/sync-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/sync/test/TestSyncModule.kt b/sync/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/sync/di/TestSyncModule.kt
similarity index 79%
rename from sync/sync-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/sync/test/TestSyncModule.kt
rename to sync/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/sync/di/TestSyncModule.kt
index ceca1cb5cd..c97328f3f3 100644
--- a/sync/sync-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/sync/test/TestSyncModule.kt
+++ b/sync/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/core/sync/di/TestSyncModule.kt
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.sync.test
+package com.google.samples.apps.nowinandroid.core.sync.di
import com.google.samples.apps.nowinandroid.core.data.util.SyncManager
import com.google.samples.apps.nowinandroid.sync.di.SyncModule
+import com.google.samples.apps.nowinandroid.sync.status.NeverSyncingSyncManager
import com.google.samples.apps.nowinandroid.sync.status.StubSyncSubscriber
import com.google.samples.apps.nowinandroid.sync.status.SyncSubscriber
import dagger.Binds
@@ -30,14 +31,10 @@ import dagger.hilt.testing.TestInstallIn
components = [SingletonComponent::class],
replaces = [SyncModule::class],
)
-internal interface TestSyncModule {
+interface TestSyncModule {
@Binds
- fun bindsSyncStatusMonitor(
- syncStatusMonitor: NeverSyncingSyncManager,
- ): SyncManager
+ fun bindsSyncManager(it: NeverSyncingSyncManager): SyncManager
@Binds
- fun bindsSyncSubscriber(
- syncSubscriber: StubSyncSubscriber,
- ): SyncSubscriber
+ fun bindsSyncSubscriber(it: StubSyncSubscriber): SyncSubscriber
}
diff --git a/sync/sync-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/sync/test/NeverSyncingSyncManager.kt b/sync/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/sync/status/NeverSyncingSyncManager.kt
similarity index 86%
rename from sync/sync-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/sync/test/NeverSyncingSyncManager.kt
rename to sync/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/sync/status/NeverSyncingSyncManager.kt
index c13b409e6b..aca0bdfabe 100644
--- a/sync/sync-test/src/main/kotlin/com/google/samples/apps/nowinandroid/core/sync/test/NeverSyncingSyncManager.kt
+++ b/sync/src/testFixtures/kotlin/com/google/samples/apps/nowinandroid/sync/status/NeverSyncingSyncManager.kt
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-package com.google.samples.apps.nowinandroid.core.sync.test
+package com.google.samples.apps.nowinandroid.sync.status
import com.google.samples.apps.nowinandroid.core.data.util.SyncManager
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import javax.inject.Inject
-internal class NeverSyncingSyncManager @Inject constructor() : SyncManager {
+class NeverSyncingSyncManager @Inject constructor() : SyncManager {
override val isSyncing: Flow = flowOf(false)
override fun requestSync() = Unit
}
diff --git a/sync/sync-test/.gitignore b/sync/sync-test/.gitignore
deleted file mode 100644
index 42afabfd2a..0000000000
--- a/sync/sync-test/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/sync/sync-test/README.md b/sync/sync-test/README.md
deleted file mode 100644
index 78876290f0..0000000000
--- a/sync/sync-test/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# :sync:sync-test module
-## Dependency graph
-![Dependency graph](../../docs/images/graphs/dep_graph_sync_sync_test.svg)
diff --git a/sync/sync-test/build.gradle.kts b/sync/sync-test/build.gradle.kts
deleted file mode 100644
index 0fac2cf837..0000000000
--- a/sync/sync-test/build.gradle.kts
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-plugins {
- alias(libs.plugins.nowinandroid.android.library)
- alias(libs.plugins.nowinandroid.android.hilt)
-}
-
-android {
- namespace = "com.google.samples.apps.nowinandroid.core.sync.test"
-}
-
-dependencies {
- implementation(libs.hilt.android.testing)
- implementation(projects.core.data)
- implementation(projects.sync.work)
-}
diff --git a/sync/sync-test/src/main/AndroidManifest.xml b/sync/sync-test/src/main/AndroidManifest.xml
deleted file mode 100644
index 27a3ea8b09..0000000000
--- a/sync/sync-test/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
diff --git a/sync/work/.gitignore b/sync/work/.gitignore
deleted file mode 100644
index 42afabfd2a..0000000000
--- a/sync/work/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file