diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionCreatorTest.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionCreatorTest.kt index b389dc5feb..ba88690587 100644 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionCreatorTest.kt +++ b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/internal/auth/DefaultSessionCreatorTest.kt @@ -16,8 +16,13 @@ package org.matrix.android.sdk.internal.auth +import android.net.Uri +import io.mockk.every +import io.mockk.mockk +import io.mockk.mockkStatic import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runBlockingTest +import org.junit.Before import org.junit.Test import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig import org.matrix.android.sdk.internal.auth.login.LoginType @@ -43,6 +48,12 @@ class DefaultSessionCreatorTest { fakeSessionParamsCreator.instance, ) + @Before + fun setup() { + mockkStatic(Uri::class) + every { Uri.parse(any()) } returns mockk() + } + @Test fun `when createSession, then session created`() = runBlockingTest { val output = sessionCreator.createSession(credentials, homeServerConnectionConfig, LoginType.UNKNOWN) diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/internal/auth/FakeSessionParamsCreator.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/internal/auth/FakeSessionParamsCreator.kt index b0757d5bd5..63cb02973c 100644 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/internal/auth/FakeSessionParamsCreator.kt +++ b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/internal/auth/FakeSessionParamsCreator.kt @@ -16,9 +16,12 @@ package org.matrix.android.sdk.test.fakes.internal.auth +import android.net.Uri import io.mockk.coEvery import io.mockk.coVerify +import io.mockk.every import io.mockk.mockk +import io.mockk.mockkStatic import org.matrix.android.sdk.api.auth.data.Credentials import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig import org.matrix.android.sdk.internal.auth.SessionParamsCreator @@ -30,6 +33,8 @@ internal class FakeSessionParamsCreator { val instance: SessionParamsCreator = mockk() init { + mockkStatic(Uri::class) + every { Uri.parse(any()) } returns mockk() coEvery { instance.create(any(), any(), any()) } returns sessionParams } diff --git a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/internal/auth/db/sessionparams/FakeSessionParamsMapperMoshi.kt b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/internal/auth/db/sessionparams/FakeSessionParamsMapperMoshi.kt index 546f8dcee9..10c3664511 100644 --- a/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/internal/auth/db/sessionparams/FakeSessionParamsMapperMoshi.kt +++ b/matrix-sdk-android/src/test/java/org/matrix/android/sdk/test/fakes/internal/auth/db/sessionparams/FakeSessionParamsMapperMoshi.kt @@ -16,9 +16,11 @@ package org.matrix.android.sdk.test.fakes.internal.auth.db.sessionparams +import android.net.Uri import com.squareup.moshi.Moshi import io.mockk.every import io.mockk.mockk +import io.mockk.mockkStatic import org.amshove.kluent.shouldBeEqualTo import org.amshove.kluent.shouldBeNull import org.matrix.android.sdk.api.auth.data.Credentials @@ -41,6 +43,8 @@ internal class FakeSessionParamsMapperMoshi { val homeServerConnectionConfigAdapter = FakeHomeServerConnectionConfigJsonAdapter() init { + mockkStatic(Uri::class) + every { Uri.parse(any()) } returns mockk() every { instance.adapter(Credentials::class.java) } returns credentialsJsonAdapter.instance every { instance.adapter(HomeServerConnectionConfig::class.java) } returns homeServerConnectionConfigAdapter.instance }