diff --git a/vector/src/test/java/im/vector/app/core/device/DefaultGetDeviceInfoUseCaseTest.kt b/vector/src/test/java/im/vector/app/core/device/DefaultGetDeviceInfoUseCaseTest.kt index 0673fbadb5..5dc0936184 100644 --- a/vector/src/test/java/im/vector/app/core/device/DefaultGetDeviceInfoUseCaseTest.kt +++ b/vector/src/test/java/im/vector/app/core/device/DefaultGetDeviceInfoUseCaseTest.kt @@ -19,6 +19,7 @@ package im.vector.app.core.device import im.vector.app.test.fakes.FakeActiveSessionHolder import im.vector.app.test.fakes.FakeCryptoService import im.vector.app.test.fakes.FakeSession +import kotlinx.coroutines.runBlocking import org.amshove.kluent.shouldBeEqualTo import org.junit.Test @@ -32,7 +33,7 @@ class DefaultGetDeviceInfoUseCaseTest { @Test fun `when execute, then get crypto device info`() { - val result = getDeviceInfoUseCase.execute() + val result = runBlocking { getDeviceInfoUseCase.execute() } result shouldBeEqualTo cryptoService.cryptoDeviceInfo } diff --git a/vector/src/test/java/im/vector/app/core/pushers/PushersManagerTest.kt b/vector/src/test/java/im/vector/app/core/pushers/PushersManagerTest.kt index 1e228353f5..7aa0647a14 100644 --- a/vector/src/test/java/im/vector/app/core/pushers/PushersManagerTest.kt +++ b/vector/src/test/java/im/vector/app/core/pushers/PushersManagerTest.kt @@ -29,6 +29,7 @@ import im.vector.app.test.fixtures.CryptoDeviceInfoFixture.aCryptoDeviceInfo import im.vector.app.test.fixtures.PusherFixture import im.vector.app.test.fixtures.SessionParamsFixture import io.mockk.mockk +import kotlinx.coroutines.runBlocking import org.amshove.kluent.shouldBeEqualTo import org.junit.Test import org.matrix.android.sdk.api.session.crypto.model.UnsignedDeviceInfo @@ -80,7 +81,9 @@ class PushersManagerTest { withEventIdOnly = true, ) - pushersManager.enqueueRegisterPusher(pushKey, gateway) + runBlocking { + pushersManager.enqueueRegisterPusher(pushKey, gateway) + } val httpPusher = pushersService.verifyEnqueueAddHttpPusher() httpPusher shouldBeEqualTo expectedHttpPusher diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeCryptoService.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeCryptoService.kt index e8bb15ac58..b5e503dd98 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeCryptoService.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeCryptoService.kt @@ -84,5 +84,5 @@ class FakeCryptoService( } } - override fun getMyCryptoDevice() = cryptoDeviceInfo + override suspend fun getMyCryptoDevice() = cryptoDeviceInfo } diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeGetDeviceInfoUseCase.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeGetDeviceInfoUseCase.kt index c284263d28..564cf7a1d5 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeGetDeviceInfoUseCase.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeGetDeviceInfoUseCase.kt @@ -17,6 +17,7 @@ package im.vector.app.test.fakes import im.vector.app.core.device.GetDeviceInfoUseCase +import io.mockk.coEvery import io.mockk.every import io.mockk.mockk import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo @@ -24,6 +25,6 @@ import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo class FakeGetDeviceInfoUseCase : GetDeviceInfoUseCase by mockk() { fun givenDeviceInfo(cryptoDeviceInfo: CryptoDeviceInfo) { - every { execute() } returns cryptoDeviceInfo + coEvery { execute() } returns cryptoDeviceInfo } }