diff --git a/core/src/main/kotlin/com/mitteloupe/cag/core/content/architecture/ArchitecturePresentationTestGradleScriptBuilder.kt b/core/src/main/kotlin/com/mitteloupe/cag/core/content/architecture/ArchitecturePresentationTestGradleScriptBuilder.kt index 998e873..270001d 100644 --- a/core/src/main/kotlin/com/mitteloupe/cag/core/content/architecture/ArchitecturePresentationTestGradleScriptBuilder.kt +++ b/core/src/main/kotlin/com/mitteloupe/cag/core/content/architecture/ArchitecturePresentationTestGradleScriptBuilder.kt @@ -10,6 +10,14 @@ fun buildArchitecturePresentationTestGradleScript(catalog: VersionCatalogReader) val pluginAliasKotlinJvm = catalog.getResolvedPluginAliasFor(PluginConstants.KOTLIN_JVM).asAccessor val aliasTestJunit = catalog.getResolvedLibraryAliasForModule(LibraryConstants.TEST_JUNIT).asAccessor + val aliasTestKotlinxCoroutines = + catalog.getResolvedLibraryAliasForModule(LibraryConstants.TEST_KOTLINX_COROUTINES).asAccessor + val aliasTestMockitoCore = + catalog.getResolvedLibraryAliasForModule(LibraryConstants.TEST_MOCKITO_CORE).asAccessor + val aliasTestMockitoKotlin = + catalog.getResolvedLibraryAliasForModule(LibraryConstants.TEST_MOCKITO_KOTLIN).asAccessor + val aliasTestMockitoAndroid = + catalog.getResolvedLibraryAliasForModule(LibraryConstants.TEST_MOCKITO_ANDROID).asAccessor val gradleFileExtender = GradleFileExtender() val ktlintPluginLine = gradleFileExtender.buildKtlintPluginLine(catalog) @@ -35,6 +43,10 @@ dependencies { implementation(libs.kotlinx.coroutines.core) implementation(libs.$aliasTestJunit) + implementation(libs.$aliasTestKotlinxCoroutines) + implementation(libs.$aliasTestMockitoCore) + implementation(libs.$aliasTestMockitoKotlin) + implementation(libs.$aliasTestMockitoAndroid) implementation(projects.coroutine) } """ diff --git a/core/src/main/kotlin/com/mitteloupe/cag/core/generation/architecture/ArchitectureModulesContentGenerator.kt b/core/src/main/kotlin/com/mitteloupe/cag/core/generation/architecture/ArchitectureModulesContentGenerator.kt index 7ad1ad1..0b5468d 100644 --- a/core/src/main/kotlin/com/mitteloupe/cag/core/generation/architecture/ArchitectureModulesContentGenerator.kt +++ b/core/src/main/kotlin/com/mitteloupe/cag/core/generation/architecture/ArchitectureModulesContentGenerator.kt @@ -55,6 +55,11 @@ class ArchitectureModulesContentGenerator( val libraries = LibraryConstants.CORE_ANDROID_LIBRARIES + + LibraryConstants.TESTING_LIBRARIES + + LibraryConstants.TEST_KOTLINX_COROUTINES + + LibraryConstants.NETWORK_LIBRARIES + + LibraryConstants.TEST_MOCKITO_LIBRARIES + + LibraryConstants.TEST_MOCKITO_ANDROID + if (enableCompose) { LibraryConstants.COMPOSE_LIBRARIES + LibraryConstants.COMPOSE_TESTING_LIBRARIES + @@ -63,9 +68,7 @@ class ArchitectureModulesContentGenerator( LibraryConstants.ANDROIDX_NAVIGATION_FRAGMENT_KTX } else { LibraryConstants.VIEW_LIBRARIES - } + - LibraryConstants.TESTING_LIBRARIES + - LibraryConstants.NETWORK_LIBRARIES + } val plugins = buildList { addAll(PluginConstants.KOTLIN_PLUGINS + PluginConstants.ANDROID_PLUGINS) diff --git a/core/src/main/kotlin/com/mitteloupe/cag/core/generation/versioncatalog/DependencyConfiguration.kt b/core/src/main/kotlin/com/mitteloupe/cag/core/generation/versioncatalog/DependencyConfiguration.kt index 3a54208..b8f3290 100644 --- a/core/src/main/kotlin/com/mitteloupe/cag/core/generation/versioncatalog/DependencyConfiguration.kt +++ b/core/src/main/kotlin/com/mitteloupe/cag/core/generation/versioncatalog/DependencyConfiguration.kt @@ -16,7 +16,7 @@ import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.COMPOSE_NAVIGATION_VERSION import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.DETEKT_VERSION import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.JUNIT4_VERSION -import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.KOTLINX_COROUTINES_CORE_VERSION +import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.KOTLINX_COROUTINES_VERSION import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.KOTLIN_VERSION import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.KSP_VERSION import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.KTLINT_VERSION @@ -31,6 +31,9 @@ import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.TEST_ANDROID_HILT_VERSION import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.TEST_ANDROID_MOCKWEBSERVER_VERSION import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.TEST_ANDROID_UI_AUTOMATOR_VERSION +import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.TEST_MOCKITO_ANDROID_VERSION +import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.TEST_MOCKITO_CORE_VERSION +import com.mitteloupe.cag.core.generation.versioncatalog.VersionCatalogConstants.TEST_MOCKITO_KOTLIN_VERSION data class DependencyConfiguration( val versions: List, @@ -39,46 +42,50 @@ data class DependencyConfiguration( ) object VersionCatalogConstants { - val KOTLIN_VERSION = VersionRequirement(key = "kotlin", version = "2.2.10") - val COMPILE_SDK_VERSION = VersionRequirement(key = "compileSdk", version = "35") - val MIN_SDK_VERSION = VersionRequirement(key = "minSdk", version = "24") - val TARGET_SDK_VERSION = VersionRequirement(key = "targetSdk", version = "35") + internal val KOTLIN_VERSION = VersionRequirement(key = "kotlin", version = "2.2.10") + internal val COMPILE_SDK_VERSION = VersionRequirement(key = "compileSdk", version = "35") + internal val MIN_SDK_VERSION = VersionRequirement(key = "minSdk", version = "24") + internal val TARGET_SDK_VERSION = VersionRequirement(key = "targetSdk", version = "35") - val ANDROID_GRADLE_PLUGIN_VERSION = VersionRequirement(key = "androidGradlePlugin", version = "8.12.2") + internal val ANDROID_GRADLE_PLUGIN_VERSION = VersionRequirement(key = "androidGradlePlugin", version = "8.12.2") - val COMPOSE_BOM_VERSION = VersionRequirement(key = "composeBom", version = "2025.08.01") - val COMPOSE_NAVIGATION_VERSION = VersionRequirement(key = "composeNavigation", version = "2.9.3") + internal val COMPOSE_BOM_VERSION = VersionRequirement(key = "composeBom", version = "2025.08.01") + internal val COMPOSE_NAVIGATION_VERSION = VersionRequirement(key = "composeNavigation", version = "2.9.3") - val JUNIT4_VERSION = VersionRequirement(key = "junit4", version = "4.13.2") - val KSP_VERSION = VersionRequirement(key = "ksp", version = "2.2.10-2.0.2") + internal val JUNIT4_VERSION = VersionRequirement(key = "junit4", version = "4.13.2") + internal val KSP_VERSION = VersionRequirement(key = "ksp", version = "2.2.10-2.0.2") - val KTLINT_VERSION = VersionRequirement(key = "ktlint", version = "13.1.0") - val DETEKT_VERSION = VersionRequirement(key = "detekt", version = "1.23.6") + internal val KTLINT_VERSION = VersionRequirement(key = "ktlint", version = "13.1.0") + internal val DETEKT_VERSION = VersionRequirement(key = "detekt", version = "1.23.6") - val ANDROIDX_CORE_KTX_VERSION = VersionRequirement(key = "androidxCoreKtx", version = "1.12.0") - val ANDROIDX_LIFECYCLE_RUNTIME_KTX_VERSION = VersionRequirement(key = "androidxLifecycleRuntimeKtx", version = "2.7.0") - val KOTLINX_COROUTINES_CORE_VERSION = VersionRequirement(key = "kotlinxCoroutinesCore", version = "1.7.3") - val MATERIAL_VERSION = VersionRequirement(key = "material", version = "1.11.0") - val OKHTTP3_VERSION = VersionRequirement(key = "okhttp3", version = "4.12.0") - val ANDROIDX_APPCOMPAT_VERSION = VersionRequirement(key = "androidxAppcompat", version = "1.6.1") + internal val ANDROIDX_CORE_KTX_VERSION = VersionRequirement(key = "androidxCoreKtx", version = "1.12.0") + internal val ANDROIDX_LIFECYCLE_RUNTIME_KTX_VERSION = VersionRequirement(key = "androidxLifecycleRuntimeKtx", version = "2.7.0") + internal val KOTLINX_COROUTINES_VERSION = VersionRequirement(key = "kotlinxCoroutines", version = "1.7.3") + internal val MATERIAL_VERSION = VersionRequirement(key = "material", version = "1.11.0") + internal val OKHTTP3_VERSION = VersionRequirement(key = "okhttp3", version = "4.12.0") + internal val ANDROIDX_APPCOMPAT_VERSION = VersionRequirement(key = "androidxAppcompat", version = "1.6.1") - val ANDROIDX_RECYCLER_VIEW_VERSION = VersionRequirement(key = "androidxRecyclerView", version = "1.3.2") - val ANDROIDX_FRAGMENT_KTX_VERSION = VersionRequirement(key = "androidxFragmentKtx", version = "1.6.2") - val ANDROIDX_NAVIGATION_FRAGMENT_KTX_VERSION = VersionRequirement(key = "androidxNavigationFragmentKtx", version = "2.7.6") - val ANDROIDX_CONSTRAINT_LAYOUT_VERSION = VersionRequirement(key = "androidxConstraintLayout", version = "2.1.4") + internal val ANDROIDX_RECYCLER_VIEW_VERSION = VersionRequirement(key = "androidxRecyclerView", version = "1.3.2") + internal val ANDROIDX_FRAGMENT_KTX_VERSION = VersionRequirement(key = "androidxFragmentKtx", version = "1.6.2") + internal val ANDROIDX_NAVIGATION_FRAGMENT_KTX_VERSION = VersionRequirement(key = "androidxNavigationFragmentKtx", version = "2.7.6") + internal val ANDROIDX_CONSTRAINT_LAYOUT_VERSION = VersionRequirement(key = "androidxConstraintLayout", version = "2.1.4") - val ANDROIDX_ACTIVITY_COMPOSE_VERSION = VersionRequirement(key = "androidxActivityCompose", version = "1.8.2") + internal val ANDROIDX_ACTIVITY_COMPOSE_VERSION = VersionRequirement(key = "androidxActivityCompose", version = "1.8.2") - val KTOR_VERSION = VersionRequirement(key = "ktor", version = "3.0.3") - val RETROFIT_VERSION = VersionRequirement(key = "retrofit", version = "2.11.0") - val OKHTTP3_LOGGING_INTERCEPTOR_VERSION = VersionRequirement(key = "okhttp3LoggingInterceptor", version = "4.12.0") + internal val KTOR_VERSION = VersionRequirement(key = "ktor", version = "3.0.3") + internal val RETROFIT_VERSION = VersionRequirement(key = "retrofit", version = "2.11.0") + internal val OKHTTP3_LOGGING_INTERCEPTOR_VERSION = VersionRequirement(key = "okhttp3LoggingInterceptor", version = "4.12.0") - val TEST_ANDROIDX_JUNIT_VERSION = VersionRequirement(key = "androidxJunit", version = "1.1.5") - val TEST_ANDROIDX_ESPRESSO_CORE_VERSION = VersionRequirement(key = "androidxEspressoCore", version = "3.5.1") - val TEST_ANDROID_HILT_VERSION = VersionRequirement(key = "androidHilt", version = "2.48") - val TEST_ANDROID_UI_AUTOMATOR_VERSION = VersionRequirement(key = "androidxUiautomator", version = "2.2.0") - val TEST_ANDROID_MOCKWEBSERVER_VERSION = VersionRequirement(key = "mockwebserver", version = "4.12.0") - val TEST_ANDROIDX_RULES_VERSION = VersionRequirement(key = "androidxTestRules", version = "1.5.0") + internal val TEST_MOCKITO_CORE_VERSION = VersionRequirement(key = "mockitoCore", version = "5.20.0") + internal val TEST_MOCKITO_KOTLIN_VERSION = VersionRequirement(key = "mockitoKotlin", version = "6.0.0") + internal val TEST_MOCKITO_ANDROID_VERSION = VersionRequirement(key = "mockitoAndroid", version = "2.28.6") + + internal val TEST_ANDROIDX_JUNIT_VERSION = VersionRequirement(key = "androidxJunit", version = "1.1.5") + internal val TEST_ANDROIDX_ESPRESSO_CORE_VERSION = VersionRequirement(key = "androidxEspressoCore", version = "3.5.1") + internal val TEST_ANDROID_HILT_VERSION = VersionRequirement(key = "androidHilt", version = "2.48") + internal val TEST_ANDROID_UI_AUTOMATOR_VERSION = VersionRequirement(key = "androidxUiautomator", version = "2.2.0") + internal val TEST_ANDROID_MOCKWEBSERVER_VERSION = VersionRequirement(key = "mockwebserver", version = "4.12.0") + internal val TEST_ANDROIDX_RULES_VERSION = VersionRequirement(key = "androidxTestRules", version = "1.5.0") val ANDROID_VERSIONS = listOf( @@ -108,7 +115,14 @@ object LibraryConstants { LibraryRequirement( key = "kotlinx-coroutines-core", module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", - version = KOTLINX_COROUTINES_CORE_VERSION + version = KOTLINX_COROUTINES_VERSION + ) + + val TEST_KOTLINX_COROUTINES = + LibraryRequirement( + key = "test-kotlinx-coroutines", + module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", + version = KOTLINX_COROUTINES_VERSION ) val COMPOSE_BOM = @@ -300,6 +314,27 @@ object LibraryConstants { version = OKHTTP3_LOGGING_INTERCEPTOR_VERSION ) + val TEST_MOCKITO_CORE = + LibraryRequirement( + key = "test-mockito-core", + module = "org.mockito:mockito-core", + version = TEST_MOCKITO_CORE_VERSION + ) + + val TEST_MOCKITO_KOTLIN = + LibraryRequirement( + key = "test-mockito-kotlin", + module = "org.mockito.kotlin:mockito-kotlin", + version = TEST_MOCKITO_KOTLIN_VERSION + ) + + val TEST_MOCKITO_ANDROID = + LibraryRequirement( + key = "test-mockito-android", + module = "com.linkedin.dexmaker:dexmaker-mockito-inline", + version = TEST_MOCKITO_ANDROID_VERSION + ) + val CORE_ANDROID_LIBRARIES = listOf( ANDROIDX_CORE_KTX, @@ -354,6 +389,12 @@ object LibraryConstants { RETROFIT, OKHTTP3_LOGGING_INTERCEPTOR ) + + val TEST_MOCKITO_LIBRARIES = + listOf( + TEST_MOCKITO_CORE, + TEST_MOCKITO_KOTLIN + ) } object PluginConstants { diff --git a/core/src/test/kotlin/com/mitteloupe/cag/core/generation/VersionCatalogUpdaterTest.kt b/core/src/test/kotlin/com/mitteloupe/cag/core/generation/VersionCatalogUpdaterTest.kt index d36f5a0..cc4498c 100644 --- a/core/src/test/kotlin/com/mitteloupe/cag/core/generation/VersionCatalogUpdaterTest.kt +++ b/core/src/test/kotlin/com/mitteloupe/cag/core/generation/VersionCatalogUpdaterTest.kt @@ -331,15 +331,15 @@ class VersionCatalogUpdaterTest { kotlin = "2.2.10" compileSdk = "35" minSdk = "24" - kotlinxCoroutinesCore = "1.7.3" + kotlinxCoroutines = "1.7.3" [libraries] - kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" } + kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" } """.trimIndent() + "\n" val dependencyConfiguration = DependencyConfiguration( - versions = listOf(VersionCatalogConstants.KOTLINX_COROUTINES_CORE_VERSION), + versions = listOf(VersionCatalogConstants.KOTLINX_COROUTINES_VERSION), libraries = listOf(LibraryConstants.KOTLINX_COROUTINES_CORE), plugins = emptyList() ) diff --git a/core/src/test/kotlin/com/mitteloupe/cag/core/generation/architecture/ArchitectureModulesContentGeneratorTest.kt b/core/src/test/kotlin/com/mitteloupe/cag/core/generation/architecture/ArchitectureModulesContentGeneratorTest.kt index 0a8264e..2f3a7f9 100644 --- a/core/src/test/kotlin/com/mitteloupe/cag/core/generation/architecture/ArchitectureModulesContentGeneratorTest.kt +++ b/core/src/test/kotlin/com/mitteloupe/cag/core/generation/architecture/ArchitectureModulesContentGeneratorTest.kt @@ -26,7 +26,8 @@ import kotlin.io.path.createTempDirectory ArchitectureModulesContentGeneratorTest.PresentationTestModule::class, ArchitectureModulesContentGeneratorTest.CoroutineModule::class, ArchitectureModulesContentGeneratorTest.InstrumentationTestModule::class, - ArchitectureModulesContentGeneratorTest.GradleFileGeneration::class + ArchitectureModulesContentGeneratorTest.GradleFileGeneration::class, + ArchitectureModulesContentGeneratorTest.GenerateFunction::class ) class ArchitectureModulesContentGeneratorTest { @RunWith(Enclosed::class) @@ -304,6 +305,252 @@ class ArchitectureModulesContentGeneratorTest { } } + class GenerateFunction { + private lateinit var classUnderTest: ArchitectureModulesContentGenerator + private lateinit var temporaryDirectory: File + + @Before + fun setUp() { + temporaryDirectory = createTempDirectory(prefix = "test").toFile() + val fileCreator = FileCreator(FakeFileSystemBridge()) + val catalogUpdater = VersionCatalogUpdater(fileCreator) + classUnderTest = + ArchitectureModulesContentGenerator( + gradleFileCreator = GradleFileCreator(fileCreator), + catalogUpdater = catalogUpdater + ) + } + + @Test + fun `Given valid inputs when generate then writes domain gradle file`() { + // Given + val architectureRoot = File(temporaryDirectory, "architecture").apply { mkdirs() } + val architecturePackageName = "com.example.architecture" + val enableCompose = true + val expectedDomain = """plugins { + id("project-java-library") + alias(libs.plugins.kotlin.jvm) +} + +dependencies { + implementation(projects.coroutine) + implementation(libs.kotlinx.coroutines.core) +} +""" + val domainGradle = File(architectureRoot, "domain/build.gradle.kts") + + // When + classUnderTest.generate(architectureRoot, architecturePackageName, enableCompose) + + // Then + assertEquals(expectedDomain, domainGradle.readText()) + } + + @Test + fun `Given valid inputs when generate then writes presentation gradle file`() { + // Given + val architectureRoot = File(temporaryDirectory, "architecture").apply { mkdirs() } + val architecturePackageName = "com.example.architecture" + val enableCompose = true + val expectedPresentation = """plugins { + id("project-java-library") + alias(libs.plugins.kotlin.jvm) +} + +kotlin { + sourceSets.all { + languageSettings.enableLanguageFeature("ExplicitBackingFields") + } +} + +dependencies { + implementation(projects.architecture.domain) + implementation(libs.kotlinx.coroutines.core) + testImplementation(libs.test.junit) +} +""" + val presentationGradle = File(architectureRoot, "presentation/build.gradle.kts") + + // When + classUnderTest.generate(architectureRoot, architecturePackageName, enableCompose) + + // Then + assertEquals(expectedPresentation, presentationGradle.readText()) + } + + @Test + fun `Given valid inputs when generate then writes UI gradle file`() { + // Given + val architectureRoot = File(temporaryDirectory, "architecture").apply { mkdirs() } + val architecturePackageName = "com.example.architecture" + val enableCompose = true + val expectedUi = """plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.ksp) + alias(libs.plugins.compose.compiler) + +} + +android { + namespace = "com.example.architecture.ui" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + minSdk = libs.versions.minSdk.get().toInt() + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + buildFeatures { + compose = true + } +} + +dependencies { + implementation(projects.architecture.presentation) + + implementation(projects.coroutine) + + implementation(libs.androidx.fragment.ktx) + implementation(libs.androidx.navigation.fragment.ktx) + + implementation(platform(libs.compose.bom)) + implementation(libs.compose.ui) +} +""" + val uiGradle = File(architectureRoot, "ui/build.gradle.kts") + + // When + classUnderTest.generate(architectureRoot, architecturePackageName, enableCompose) + + // Then + assertEquals(expectedUi, uiGradle.readText()) + } + + @Test + fun `Given valid inputs when generate then writes presentation-test gradle file`() { + // Given + val architectureRoot = File(temporaryDirectory, "architecture").apply { mkdirs() } + val architecturePackageName = "com.example.architecture" + val enableCompose = true + val expectedPresentationTest = """plugins { + id("project-java-library") + alias(libs.plugins.kotlin.jvm) +} + +dependencies { + implementation(projects.architecture.presentation) + implementation(projects.architecture.domain) + + implementation(libs.kotlinx.coroutines.core) + + implementation(libs.test.junit) + implementation(libs.test.kotlinx.coroutines) + implementation(libs.test.mockito.core) + implementation(libs.test.mockito.kotlin) + implementation(libs.test.mockito.android) + implementation(projects.coroutine) +} +""" + val presentationTestGradle = File(architectureRoot, "presentation-test/build.gradle.kts") + + // When + classUnderTest.generate(architectureRoot, architecturePackageName, enableCompose) + + // Then + assertEquals(expectedPresentationTest, presentationTestGradle.readText()) + } + + @Test + fun `Given valid inputs when generate then writes instrumentation test gradle file`() { + // Given + val architectureRoot = File(temporaryDirectory, "architecture").apply { mkdirs() } + val architecturePackageName = "com.example.architecture" + val enableCompose = true + val expectedInstrumentationTest = """plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.compose.compiler) +} + +android { + namespace = "com.example.test" + compileSdk = libs.versions.compileSdk.get().toInt() + + defaultConfig { + minSdk = libs.versions.minSdk.get().toInt() + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + buildFeatures { + compose = true + } +} + +kotlin { + sourceSets.all { + languageSettings.enableLanguageFeature("ExplicitBackingFields") + } +} + +dependencies { + implementation(libs.material) + + implementation(platform(libs.compose.bom)) + implementation(libs.compose.ui) + implementation(libs.compose.ui.graphics) + implementation(libs.compose.ui.tooling.preview) + implementation(libs.compose.material3) + + implementation(libs.test.junit) + implementation(libs.test.androidx.junit) + implementation(libs.test.androidx.espresso.core) + implementation(libs.test.compose.ui.junit4) + implementation(libs.test.android.hilt) + implementation(libs.test.android.uiautomator) + implementation(libs.test.androidx.espresso.core) + implementation(libs.okhttp3) + implementation(libs.test.android.mockwebserver) + implementation(libs.androidx.appcompat) + implementation(libs.test.androidx.rules) + implementation(libs.androidx.recyclerview) + implementation(kotlin("reflect")) +} +""" + val instrumentationTestGradle = File(architectureRoot, "instrumentation-test/build.gradle.kts") + + // When + classUnderTest.generate(architectureRoot, architecturePackageName, enableCompose) + + // Then + assertEquals(expectedInstrumentationTest, instrumentationTestGradle.readText()) + } + } + class DomainModule { private lateinit var classUnderTest: DomainModuleCreator private lateinit var temporaryDirectory: File @@ -2597,6 +2844,10 @@ dependencies { implementation(libs.kotlinx.coroutines.core) implementation(libs.test.junit) + implementation(libs.test.kotlinx.coroutines) + implementation(libs.test.mockito.core) + implementation(libs.test.mockito.kotlin) + implementation(libs.test.mockito.android) implementation(projects.coroutine) } """