diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 4b90be1..1c9fc52 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -5,7 +5,8 @@ object Versions { const val ANDROID_GRADLE_PLUGIN = "7.4.2" const val JUNIT = "4.13.2" const val ROBOLECTRIC = "4.10.3" - const val MOCKITO = "4.11.0" + const val MOCKITO = "5.5.0" + const val MOCKITO_INLINE = "5.2.0" const val MOCKITO_KOTLIN = "4.1.0" const val CORE_KTX = "1.6.0" const val FRAGMENT_KTX = "1.2.4" @@ -38,7 +39,7 @@ object Libs { const val CORE_KTX = "androidx.core:core-ktx:${Versions.CORE_KTX}" const val KOTLIN_TESTS = "org.jetbrains.kotlin:kotlin-test:${Versions.KOTLIN}" const val FRAGMENT_KTX = "androidx.fragment:fragment-ktx:${Versions.FRAGMENT_KTX}" - const val MOCKITO_INLINE = "org.mockito:mockito-inline:${Versions.MOCKITO}" + const val MOCKITO_INLINE = "org.mockito:mockito-inline:${Versions.MOCKITO_INLINE}" const val LIFECYCLE = "androidx.lifecycle:lifecycle-common-java8:${Versions.LIFECYCLE}" @Suppress("MaxLineLength") const val VIEW_BINDING_DELEGATE = "com.github.kirich1409:viewbindingpropertydelegate-noreflection:${Versions.VIEW_BINDING_DELEGATE}" diff --git a/library/src/test/java/com/vinted/coper/CoperImplTest.kt b/library/src/test/java/com/vinted/coper/CoperImplTest.kt index 07678b1..ad4dd18 100644 --- a/library/src/test/java/com/vinted/coper/CoperImplTest.kt +++ b/library/src/test/java/com/vinted/coper/CoperImplTest.kt @@ -16,6 +16,7 @@ import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.mockito.Mockito.* +import org.mockito.internal.util.MockUtil import org.mockito.kotlin.anyArray import org.mockito.kotlin.anyOrNull import org.mockito.kotlin.whenever @@ -846,6 +847,8 @@ class CoperImplTest { private suspend fun CoperImpl.mockGetFragmentWithStub() { val coperFragment = getFragmentSafely() + if (MockUtil.isMock(coperFragment)) return + val spyCoperFragment = spy(coperFragment) // This is needed because spy creates new instance and stubbing needs exact reference coperFragment.requireActivity().supportFragmentManager.beginTransaction()