diff --git a/app/build.gradle b/app/build.gradle index 2a7b3cf..d63bebe 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -83,20 +83,17 @@ afterEvaluate { } dependencies { - - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "androidx.core:core-ktx:$androidx_core_version" implementation "androidx.appcompat:appcompat:$androidx_appcompat_version" implementation "com.google.android.material:material:$androidx_material_version" implementation "androidx.constraintlayout:constraintlayout:$androidx_constraintlayout_version" implementation "androidx.lifecycle:lifecycle-livedata-core-ktx:$androidx_livedata_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$androidx_livedata_version" + implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$androidx_livedata_version" implementation "androidx.swiperefreshlayout:swiperefreshlayout:$androidx_swiperefreshlayout_version" // Koin - implementation "org.koin:koin-androidx-scope:$koin_version" - implementation "org.koin:koin-androidx-viewmodel:$koin_version" - implementation "org.koin:koin-androidx-fragment:$koin_version" + implementation "io.insert-koin:koin-android:$koin_version" implementation "androidx.room:room-runtime:$androidx_room_version" kapt "androidx.room:room-compiler:$androidx_room_version" @@ -113,7 +110,7 @@ dependencies { testImplementation "org.mockito.kotlin:mockito-kotlin:$testing_kotlin_mockito_version" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" testImplementation "com.jraska.livedata:testing-ktx:$testing_livedata_version" - testImplementation "org.koin:koin-test:$koin_version" + testImplementation "io.insert-koin:koin-test-junit5:$koin_version" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version" // robolectric specific @@ -130,7 +127,7 @@ dependencies { testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$testing_junit5_version" androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" - androidTestImplementation "org.koin:koin-test:$koin_version" + androidTestImplementation "io.insert-koin:koin-test-junit4:$koin_version" androidTestImplementation "junit:junit:$testing_junit4_version" androidTestImplementation "androidx.test:core:$testing_androidx_code_version" androidTestImplementation "androidx.test:runner:$testing_androidx_code_version" diff --git a/app/src/androidTest/java/org/fnives/test/showcase/testutils/configuration/AndroidTestServerTypeConfiguration.kt b/app/src/androidTest/java/org/fnives/test/showcase/testutils/configuration/AndroidTestServerTypeConfiguration.kt index 46a59a3..319668e 100644 --- a/app/src/androidTest/java/org/fnives/test/showcase/testutils/configuration/AndroidTestServerTypeConfiguration.kt +++ b/app/src/androidTest/java/org/fnives/test/showcase/testutils/configuration/AndroidTestServerTypeConfiguration.kt @@ -22,7 +22,7 @@ object AndroidTestServerTypeConfiguration : ServerTypeConfiguration, KoinTest { .build() loadKoinModules( module { - single(qualifier = sessionless, override = true) { okHttpClientWithCertificate } + single(qualifier = sessionless) { okHttpClientWithCertificate } } ) } diff --git a/app/src/robolectricTest/java/org/fnives/test/showcase/favourite/FavouriteContentLocalStorageImplTest.kt b/app/src/robolectricTest/java/org/fnives/test/showcase/favourite/FavouriteContentLocalStorageImplTest.kt index da79993..06d314b 100644 --- a/app/src/robolectricTest/java/org/fnives/test/showcase/favourite/FavouriteContentLocalStorageImplTest.kt +++ b/app/src/robolectricTest/java/org/fnives/test/showcase/favourite/FavouriteContentLocalStorageImplTest.kt @@ -1,12 +1,16 @@ package org.fnives.test.showcase.favourite import androidx.test.ext.junit.runners.AndroidJUnit4 +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.take import kotlinx.coroutines.flow.toList import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.TestCoroutineDispatcher +import kotlinx.coroutines.test.TestCoroutineScope +import kotlinx.coroutines.test.runBlockingTest import org.fnives.test.showcase.core.storage.content.FavouriteContentLocalStorage import org.fnives.test.showcase.model.content.ContentId import org.fnives.test.showcase.storage.database.DatabaseInitialization @@ -20,6 +24,7 @@ import org.koin.test.KoinTest import org.koin.test.inject @Suppress("TestFunctionName") +@OptIn(ExperimentalCoroutinesApi::class) @RunWith(AndroidJUnit4::class) internal class FavouriteContentLocalStorageImplTest : KoinTest { @@ -39,12 +44,12 @@ internal class FavouriteContentLocalStorageImplTest : KoinTest { @Test fun GIVEN_content_id_WHEN_added_to_Favourite_THEN_it_can_be_read_out() = runBlocking { - val expected = listOf(ContentId("a")) + val expected = listOf(ContentId("a")) - sut.markAsFavourite(ContentId("a")) - val actual = sut.observeFavourites().first() + sut.markAsFavourite(ContentId("a")) + val actual = sut.observeFavourites().first() - Assert.assertEquals(expected, actual) + Assert.assertEquals(expected, actual) } @Test @@ -63,6 +68,7 @@ internal class FavouriteContentLocalStorageImplTest : KoinTest { runBlocking { val expected = listOf(listOf(), listOf(ContentId("a"))) + val testDispatcher = TestCoroutineDispatcher() val actual = async(testDispatcher) { sut.observeFavourites().take(2).toList() } @@ -79,6 +85,7 @@ internal class FavouriteContentLocalStorageImplTest : KoinTest { val expected = listOf(listOf(ContentId("a")), listOf()) sut.markAsFavourite(ContentId("a")) + val testDispatcher = TestCoroutineDispatcher() val actual = async(testDispatcher) { sut.observeFavourites().take(2).toList() } diff --git a/app/src/test/java/org/fnives/test/showcase/ui/auth/CodeKataAuthViewModel.kt b/app/src/test/java/org/fnives/test/showcase/ui/auth/CodeKataAuthViewModel.kt index cff5a46..917f67e 100644 --- a/app/src/test/java/org/fnives/test/showcase/ui/auth/CodeKataAuthViewModel.kt +++ b/app/src/test/java/org/fnives/test/showcase/ui/auth/CodeKataAuthViewModel.kt @@ -4,11 +4,13 @@ import org.fnives.test.showcase.core.login.LoginUseCase import org.fnives.test.showcase.testutils.InstantExecutorExtension import org.fnives.test.showcase.testutils.TestMainDispatcher import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith import org.mockito.kotlin.mock +@Disabled("CodeKata") @ExtendWith(InstantExecutorExtension::class, TestMainDispatcher::class) class CodeKataAuthViewModel { diff --git a/app/src/test/java/org/fnives/test/showcase/ui/splash/CodeKataSplashViewModelTest.kt b/app/src/test/java/org/fnives/test/showcase/ui/splash/CodeKataSplashViewModelTest.kt index 26d39b2..4e6738d 100644 --- a/app/src/test/java/org/fnives/test/showcase/ui/splash/CodeKataSplashViewModelTest.kt +++ b/app/src/test/java/org/fnives/test/showcase/ui/splash/CodeKataSplashViewModelTest.kt @@ -5,6 +5,7 @@ import org.fnives.test.showcase.testutils.InstantExecutorExtension import org.fnives.test.showcase.testutils.TestMainDispatcher import org.fnives.test.showcase.ui.shared.Event import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith @@ -12,6 +13,7 @@ import org.mockito.kotlin.doReturn import org.mockito.kotlin.mock import org.mockito.kotlin.whenever +@Disabled("CodeKata") internal class CodeKataSplashViewModelTest { @BeforeEach diff --git a/app/src/test/resources/robolectric.properties b/app/src/test/resources/robolectric.properties index 0b813b6..bcd587b 100644 --- a/app/src/test/resources/robolectric.properties +++ b/app/src/test/resources/robolectric.properties @@ -1,2 +1,3 @@ sdk=28 shadows=org.fnives.test.showcase.testutils.shadow.ShadowSnackbar +instrumentedPackages=androidx.loader.content diff --git a/build.gradle b/build.gradle index f688044..a53abdc 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,11 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = "1.4.32" + ext.kotlin_version = "1.5.30" ext.detekt_version = "1.16.0" repositories { + mavenCentral() google() maven { url "https://plugins.gradle.org/m2/" } - jcenter() } dependencies { classpath "com.android.tools.build:gradle:4.1.3" @@ -47,8 +47,8 @@ detekt { allprojects { repositories { + mavenCentral() google() - jcenter() } } diff --git a/core/build.gradle b/core/build.gradle index 1e5acf0..5d442cc 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -17,14 +17,19 @@ test { } } +compileKotlin { + kotlinOptions { + freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" + } +} + dependencies { - api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" api project(":model") implementation project(":network") - testImplementation "org.koin:koin-test:$koin_version" + testImplementation "io.insert-koin:koin-test-junit5:$koin_version" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" testImplementation "org.mockito.kotlin:mockito-kotlin:$testing_kotlin_mockito_version" testImplementation "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version" diff --git a/core/src/main/java/org/fnives/test/showcase/core/content/ContentRepository.kt b/core/src/main/java/org/fnives/test/showcase/core/content/ContentRepository.kt index 519110d..b243db5 100644 --- a/core/src/main/java/org/fnives/test/showcase/core/content/ContentRepository.kt +++ b/core/src/main/java/org/fnives/test/showcase/core/content/ContentRepository.kt @@ -1,5 +1,6 @@ package org.fnives.test.showcase.core.content +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.distinctUntilChanged @@ -24,6 +25,8 @@ internal class ContentRepository(private val contentRemoteSource: ContentRemoteS } emit(response) } + + @OptIn(ExperimentalCoroutinesApi::class) val contents: Flow>> = mutableContentFlow.flatMapLatest { if (it.item != null) flowOf(Resource.Success(it.item)) else requestFlow } diff --git a/core/src/main/java/org/fnives/test/showcase/core/di/createCoreModule.kt b/core/src/main/java/org/fnives/test/showcase/core/di/createCoreModule.kt index a2b18d1..d3b6bc5 100644 --- a/core/src/main/java/org/fnives/test/showcase/core/di/createCoreModule.kt +++ b/core/src/main/java/org/fnives/test/showcase/core/di/createCoreModule.kt @@ -37,7 +37,7 @@ fun createCoreModule( .plus(repositoryModule()) fun repositoryModule() = module { - single(override = true) { ContentRepository(get()) } + single { ContentRepository(get()) } } fun useCaseModule() = module { diff --git a/core/src/test/java/org/fnives/test/showcase/core/content/CodeKataContentRepositoryTest.kt b/core/src/test/java/org/fnives/test/showcase/core/content/CodeKataContentRepositoryTest.kt index 49165de..c8f74fe 100644 --- a/core/src/test/java/org/fnives/test/showcase/core/content/CodeKataContentRepositoryTest.kt +++ b/core/src/test/java/org/fnives/test/showcase/core/content/CodeKataContentRepositoryTest.kt @@ -12,10 +12,7 @@ import org.fnives.test.showcase.model.content.ContentId import org.fnives.test.showcase.model.content.ImageUrl import org.fnives.test.showcase.model.shared.Resource import org.fnives.test.showcase.network.content.ContentRemoteSource -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.DisplayName -import org.junit.jupiter.api.Test +import org.junit.jupiter.api.* import org.mockito.kotlin.doAnswer import org.mockito.kotlin.doReturn import org.mockito.kotlin.doSuspendableAnswer @@ -26,6 +23,7 @@ import org.mockito.kotlin.verify import org.mockito.kotlin.verifyNoMoreInteractions import org.mockito.kotlin.whenever +@Disabled("CodeKata") class CodeKataContentRepositoryTest { @BeforeEach diff --git a/core/src/test/java/org/fnives/test/showcase/core/content/GetAllContentUseCaseTest.kt b/core/src/test/java/org/fnives/test/showcase/core/content/GetAllContentUseCaseTest.kt index 1fd4406..5e36cd8 100644 --- a/core/src/test/java/org/fnives/test/showcase/core/content/GetAllContentUseCaseTest.kt +++ b/core/src/test/java/org/fnives/test/showcase/core/content/GetAllContentUseCaseTest.kt @@ -1,5 +1,6 @@ package org.fnives.test.showcase.core.content +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.async import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.take @@ -20,6 +21,7 @@ import org.mockito.kotlin.mock import org.mockito.kotlin.whenever @Suppress("TestFunctionName") +@OptIn(ExperimentalCoroutinesApi::class) internal class GetAllContentUseCaseTest { private lateinit var sut: GetAllContentUseCase @@ -36,71 +38,78 @@ internal class GetAllContentUseCaseTest { mockContentRepository = mock() favouriteContentIdFlow = MutableStateFlow(emptyList()) contentFlow = MutableStateFlow(Resource.Loading()) - whenever(mockFavouriteContentLocalStorage.observeFavourites()).doReturn(favouriteContentIdFlow) + whenever(mockFavouriteContentLocalStorage.observeFavourites()).doReturn( + favouriteContentIdFlow + ) whenever(mockContentRepository.contents).doReturn(contentFlow) sut = GetAllContentUseCase(mockContentRepository, mockFavouriteContentLocalStorage) } @Test - fun GIVEN_loading_AND_empty_favourite_WHEN_observed_THEN_loading_is_shown() = runBlockingTest(testDispatcher) { - favouriteContentIdFlow.value = emptyList() - contentFlow.value = Resource.Loading() - val expected = Resource.Loading>() + fun GIVEN_loading_AND_empty_favourite_WHEN_observed_THEN_loading_is_shown() = + runBlockingTest(testDispatcher) { + favouriteContentIdFlow.value = emptyList() + contentFlow.value = Resource.Loading() + val expected = Resource.Loading>() - val actual = sut.get().take(1).toList() + val actual = sut.get().take(1).toList() - Assertions.assertEquals(listOf(expected), actual) - } + Assertions.assertEquals(listOf(expected), actual) + } @Test - fun GIVEN_loading_AND_listOfFavourite_WHEN_observed_THEN_loading_is_shown() = runBlockingTest(testDispatcher) { - favouriteContentIdFlow.value = listOf(ContentId("a")) - contentFlow.value = Resource.Loading() - val expected = Resource.Loading>() + fun GIVEN_loading_AND_listOfFavourite_WHEN_observed_THEN_loading_is_shown() = + runBlockingTest(testDispatcher) { + favouriteContentIdFlow.value = listOf(ContentId("a")) + contentFlow.value = Resource.Loading() + val expected = Resource.Loading>() - val actual = sut.get().take(1).toList() + val actual = sut.get().take(1).toList() - Assertions.assertEquals(listOf(expected), actual) - } + Assertions.assertEquals(listOf(expected), actual) + } @Test - fun GIVEN_error_AND_empty_favourite_WHEN_observed_THEN_error_is_shown() = runBlockingTest(testDispatcher) { - favouriteContentIdFlow.value = emptyList() - val exception = Throwable() - contentFlow.value = Resource.Error(exception) - val expected = Resource.Error>(exception) + fun GIVEN_error_AND_empty_favourite_WHEN_observed_THEN_error_is_shown() = + runBlockingTest(testDispatcher) { + favouriteContentIdFlow.value = emptyList() + val exception = Throwable() + contentFlow.value = Resource.Error(exception) + val expected = Resource.Error>(exception) - val actual = sut.get().take(1).toList() + val actual = sut.get().take(1).toList() - Assertions.assertEquals(listOf(expected), actual) - } + Assertions.assertEquals(listOf(expected), actual) + } @Test - fun GIVEN_error_AND_listOfFavourite_WHEN_observed_THEN_error_is_shown() = runBlockingTest(testDispatcher) { - favouriteContentIdFlow.value = listOf(ContentId("b")) - val exception = Throwable() - contentFlow.value = Resource.Error(exception) - val expected = Resource.Error>(exception) + fun GIVEN_error_AND_listOfFavourite_WHEN_observed_THEN_error_is_shown() = + runBlockingTest(testDispatcher) { + favouriteContentIdFlow.value = listOf(ContentId("b")) + val exception = Throwable() + contentFlow.value = Resource.Error(exception) + val expected = Resource.Error>(exception) - val actual = sut.get().take(1).toList() + val actual = sut.get().take(1).toList() - Assertions.assertEquals(listOf(expected), actual) - } + Assertions.assertEquals(listOf(expected), actual) + } @Test - fun GIVEN_listOfContent_AND_empty_favourite_WHEN_observed_THEN_favourites_are_returned() = runBlockingTest(testDispatcher) { - favouriteContentIdFlow.value = emptyList() - val content = Content(ContentId("a"), "b", "c", ImageUrl("d")) - contentFlow.value = Resource.Success(listOf(content)) - val items = listOf( - FavouriteContent(content, false) - ) - val expected = Resource.Success(items) + fun GIVEN_listOfContent_AND_empty_favourite_WHEN_observed_THEN_favourites_are_returned() = + runBlockingTest(testDispatcher) { + favouriteContentIdFlow.value = emptyList() + val content = Content(ContentId("a"), "b", "c", ImageUrl("d")) + contentFlow.value = Resource.Success(listOf(content)) + val items = listOf( + FavouriteContent(content, false) + ) + val expected = Resource.Success(items) - val actual = sut.get().take(1).toList() + val actual = sut.get().take(1).toList() - Assertions.assertEquals(listOf(expected), actual) - } + Assertions.assertEquals(listOf(expected), actual) + } @Test fun GIVEN_listOfContent_AND_other_favourite_id_WHEN_observed_THEN_favourites_are_returned() = diff --git a/core/src/test/java/org/fnives/test/showcase/core/login/CodeKataSecondLoginUseCaseTest.kt b/core/src/test/java/org/fnives/test/showcase/core/login/CodeKataSecondLoginUseCaseTest.kt index 306443d..3bef542 100644 --- a/core/src/test/java/org/fnives/test/showcase/core/login/CodeKataSecondLoginUseCaseTest.kt +++ b/core/src/test/java/org/fnives/test/showcase/core/login/CodeKataSecondLoginUseCaseTest.kt @@ -9,12 +9,10 @@ import org.fnives.test.showcase.model.session.Session import org.fnives.test.showcase.model.shared.Answer import org.fnives.test.showcase.network.auth.LoginRemoteSource import org.fnives.test.showcase.network.auth.model.LoginStatusResponses -import org.junit.jupiter.api.Assertions -import org.junit.jupiter.api.BeforeEach -import org.junit.jupiter.api.DisplayName -import org.junit.jupiter.api.Test +import org.junit.jupiter.api.* import org.mockito.kotlin.* +@Disabled("CodeKata") class CodeKataSecondLoginUseCaseTest { @BeforeEach diff --git a/core/src/test/java/org/fnives/test/showcase/core/session/CodeKataFirstSessionExpirationAdapterTest.kt b/core/src/test/java/org/fnives/test/showcase/core/session/CodeKataFirstSessionExpirationAdapterTest.kt index 5b50495..686fa7f 100644 --- a/core/src/test/java/org/fnives/test/showcase/core/session/CodeKataFirstSessionExpirationAdapterTest.kt +++ b/core/src/test/java/org/fnives/test/showcase/core/session/CodeKataFirstSessionExpirationAdapterTest.kt @@ -1,10 +1,12 @@ package org.fnives.test.showcase.core.session import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.Disabled import org.junit.jupiter.api.DisplayName import org.junit.jupiter.api.Test import org.mockito.kotlin.* +@Disabled("CodeKata") class CodeKataFirstSessionExpirationAdapterTest { } \ No newline at end of file diff --git a/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker index 092e268..ca6ee9c 100644 --- a/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker +++ b/core/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -1 +1 @@ -#mock-maker-inline \ No newline at end of file +mock-maker-inline \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 98bed16..f9842bc 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,5 +17,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true +android.jetifier.blacklist=bcprov-jdk15on # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official \ No newline at end of file diff --git a/gradlescripts/versions.gradle b/gradlescripts/versions.gradle index 576eb20..4f8ed25 100644 --- a/gradlescripts/versions.gradle +++ b/gradlescripts/versions.gradle @@ -1,28 +1,28 @@ project.ext { - androidx_core_version = "1.3.2" - androidx_appcompat_version = "1.2.0" - androidx_material_version = "1.3.0" - androidx_constraintlayout_version = "2.0.4" + androidx_core_version = "1.6.0" + androidx_appcompat_version = "1.3.1" + androidx_material_version = "1.4.0" + androidx_constraintlayout_version = "2.1.0" androidx_livedata_version = "2.3.1" androidx_swiperefreshlayout_version = "1.1.0" - androidx_room_version = "2.2.6" + androidx_room_version = "2.3.0" coroutines_version = "1.4.3" - koin_version = "2.2.2" + koin_version = "3.1.2" coil_version = "1.1.1" retrofit_version = "2.9.0" okhttp_version = "4.9.1" - moshi_version = "1.11.0" + moshi_version = "1.12.0" - testing_androidx_code_version = "1.3.0" - testing_androidx_junit_version = "1.1.2" + testing_androidx_code_version = "1.4.0" + testing_androidx_junit_version = "1.1.3" testing_androidx_arch_core_version = "2.1.0" - testing_livedata_version = "1.1.2" + testing_livedata_version = "1.2.0" testing_kotlin_mockito_version = "3.1.0" testing_junit5_version = "5.7.0" testing_json_assert_version = "1.5.0" testing_junit4_version = "4.13.2" - testing_robolectric_version = "4.5.1" - testing_espresso_version = "3.3.0" + testing_robolectric_version = "4.6.1" + testing_espresso_version = "3.4.0" testing_okhttp3_idling_resource_version = "1.0.0" } \ No newline at end of file diff --git a/mockserver/build.gradle b/mockserver/build.gradle index acda750..4b481ef 100644 --- a/mockserver/build.gradle +++ b/mockserver/build.gradle @@ -9,8 +9,6 @@ java { } dependencies { - api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - api project(":model") api "com.squareup.okhttp3:mockwebserver:$okhttp_version" diff --git a/mockserver/src/main/java/org/fnives/test/showcase/network/mockserver/MockServerScenarioSetup.kt b/mockserver/src/main/java/org/fnives/test/showcase/network/mockserver/MockServerScenarioSetup.kt index 6946a59..b1da9c2 100644 --- a/mockserver/src/main/java/org/fnives/test/showcase/network/mockserver/MockServerScenarioSetup.kt +++ b/mockserver/src/main/java/org/fnives/test/showcase/network/mockserver/MockServerScenarioSetup.kt @@ -70,7 +70,7 @@ class MockServerScenarioSetup internal constructor( companion object { const val PORT: Int = 7335 - val HTTP_BASE_URL get() = "http://${InetAddress.getLocalHost().hostName}" + val HTTP_BASE_URL get() = "http://${InetAddress.getLocalHost().canonicalHostName}" val HTTPS_BASE_URL get() = "https://localhost" private fun MockWebServer.useHttps(): HandshakeCertificates { diff --git a/model/build.gradle b/model/build.gradle index 505234c..e30cb2f 100644 --- a/model/build.gradle +++ b/model/build.gradle @@ -10,10 +10,6 @@ java { compileKotlin { kotlinOptions { - freeCompilerArgs = ["-Xinline-classes"] + freeCompilerArgs += "-Xinline-classes" } } - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" -} \ No newline at end of file diff --git a/model/src/main/java/org/fnives/test/showcase/model/content/ContentId.kt b/model/src/main/java/org/fnives/test/showcase/model/content/ContentId.kt index c0b2c83..cc76cea 100644 --- a/model/src/main/java/org/fnives/test/showcase/model/content/ContentId.kt +++ b/model/src/main/java/org/fnives/test/showcase/model/content/ContentId.kt @@ -1,3 +1,4 @@ package org.fnives.test.showcase.model.content -inline class ContentId(val id: String) +@JvmInline +value class ContentId(val id: String) diff --git a/model/src/main/java/org/fnives/test/showcase/model/content/ImageUrl.kt b/model/src/main/java/org/fnives/test/showcase/model/content/ImageUrl.kt index b304fa8..a58c38b 100644 --- a/model/src/main/java/org/fnives/test/showcase/model/content/ImageUrl.kt +++ b/model/src/main/java/org/fnives/test/showcase/model/content/ImageUrl.kt @@ -1,3 +1,4 @@ package org.fnives.test.showcase.model.content -inline class ImageUrl(val url: String) +@JvmInline +value class ImageUrl(val url: String) diff --git a/model/src/main/java/org/fnives/test/showcase/model/network/BaseUrl.kt b/model/src/main/java/org/fnives/test/showcase/model/network/BaseUrl.kt index 1b8a6e4..53fb2ba 100644 --- a/model/src/main/java/org/fnives/test/showcase/model/network/BaseUrl.kt +++ b/model/src/main/java/org/fnives/test/showcase/model/network/BaseUrl.kt @@ -1,3 +1,4 @@ package org.fnives.test.showcase.model.network -inline class BaseUrl(val baseUrl: String) +@JvmInline +value class BaseUrl(val baseUrl: String) diff --git a/network/build.gradle b/network/build.gradle index 9a11548..d49020e 100644 --- a/network/build.gradle +++ b/network/build.gradle @@ -19,7 +19,6 @@ test { } dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "com.squareup.retrofit2:retrofit:$retrofit_version" @@ -27,15 +26,15 @@ dependencies { implementation "com.squareup.moshi:moshi:$moshi_version" kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version" implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version" - api "org.koin:koin-core:$koin_version" + api "io.insert-koin:koin-core:$koin_version" api project(":model") testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" testImplementation "org.mockito.kotlin:mockito-kotlin:$testing_kotlin_mockito_version" - testImplementation "org.junit.jupiter:junit-jupiter-engine:5.7.0" + testImplementation "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version" testImplementation project(':mockserver') - testImplementation "org.koin:koin-test:$koin_version" + testImplementation "io.insert-koin:koin-test-junit5:$koin_version" testImplementation "org.skyscreamer:jsonassert:$testing_json_assert_version" testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$testing_junit5_version" } \ No newline at end of file diff --git a/network/src/main/java/org/fnives/test/showcase/network/di/createNetworkmodules.kt b/network/src/main/java/org/fnives/test/showcase/network/di/createNetworkmodules.kt index 722cc4c..b4b0e8b 100644 --- a/network/src/main/java/org/fnives/test/showcase/network/di/createNetworkmodules.kt +++ b/network/src/main/java/org/fnives/test/showcase/network/di/createNetworkmodules.kt @@ -50,7 +50,7 @@ private fun contentModule() = module { private fun sessionlessNetworkingModule(baseUrl: BaseUrl, enableLogging: Boolean) = module { factory { MoshiConverterFactory.create() } - single(qualifier = sessionless, override = true) { + single(qualifier = sessionless) { OkHttpClient.Builder() .addInterceptor(PlatformInterceptor()) .setupLogging(enableLogging) diff --git a/network/src/test/java/org/fnives/test/showcase/network/auth/CodeKataLoginRemoteSourceTest.kt b/network/src/test/java/org/fnives/test/showcase/network/auth/CodeKataLoginRemoteSourceTest.kt index c26664d..1baa1d1 100644 --- a/network/src/test/java/org/fnives/test/showcase/network/auth/CodeKataLoginRemoteSourceTest.kt +++ b/network/src/test/java/org/fnives/test/showcase/network/auth/CodeKataLoginRemoteSourceTest.kt @@ -22,6 +22,7 @@ import org.skyscreamer.jsonassert.JSONCompareMode import java.io.BufferedReader import java.io.InputStreamReader +@Disabled("CodeKata") class CodeKataLoginRemoteSourceTest { @BeforeEach diff --git a/network/src/test/java/org/fnives/test/showcase/network/content/CodeKataSessionExpirationTest.kt b/network/src/test/java/org/fnives/test/showcase/network/content/CodeKataSessionExpirationTest.kt index 93d3408..a977bf4 100644 --- a/network/src/test/java/org/fnives/test/showcase/network/content/CodeKataSessionExpirationTest.kt +++ b/network/src/test/java/org/fnives/test/showcase/network/content/CodeKataSessionExpirationTest.kt @@ -17,6 +17,7 @@ import org.koin.test.KoinTest import org.koin.test.inject import org.mockito.kotlin.* +@Disabled("CodeKata") class CodeKataSessionExpirationTest : KoinTest { private val sut by inject()