Using shouldBeNull() method in unit tests

This commit is contained in:
Maxime NATUREL 2022-09-13 14:43:23 +02:00
parent 279820224c
commit a1bdfd1a5c
1 changed files with 3 additions and 2 deletions

View File

@ -34,6 +34,7 @@ import kotlinx.coroutines.flow.firstOrNull
import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
import org.amshove.kluent.shouldBeEqualTo import org.amshove.kluent.shouldBeEqualTo
import org.amshove.kluent.shouldBeNull
import org.junit.After import org.junit.After
import org.junit.Before import org.junit.Before
import org.junit.Test import org.junit.Test
@ -117,7 +118,7 @@ class GetDeviceFullInfoUseCaseTest {
val deviceFullInfo = getDeviceFullInfoUseCase.execute(A_DEVICE_ID).firstOrNull() val deviceFullInfo = getDeviceFullInfoUseCase.execute(A_DEVICE_ID).firstOrNull()
// Then // Then
deviceFullInfo shouldBeEqualTo null deviceFullInfo.shouldBeNull()
verify { fakeActiveSessionHolder.instance.getSafeActiveSession() } verify { fakeActiveSessionHolder.instance.getSafeActiveSession() }
verify { fakeActiveSessionHolder.fakeSession.fakeCryptoService.getMyDevicesInfoLive(A_DEVICE_ID).asFlow() } verify { fakeActiveSessionHolder.fakeSession.fakeCryptoService.getMyDevicesInfoLive(A_DEVICE_ID).asFlow() }
verify { fakeActiveSessionHolder.fakeSession.fakeCryptoService.getLiveCryptoDeviceInfoWithId(A_DEVICE_ID).asFlow() } verify { fakeActiveSessionHolder.fakeSession.fakeCryptoService.getLiveCryptoDeviceInfoWithId(A_DEVICE_ID).asFlow() }
@ -132,7 +133,7 @@ class GetDeviceFullInfoUseCaseTest {
val deviceFullInfo = getDeviceFullInfoUseCase.execute(A_DEVICE_ID).firstOrNull() val deviceFullInfo = getDeviceFullInfoUseCase.execute(A_DEVICE_ID).firstOrNull()
// Then // Then
deviceFullInfo shouldBeEqualTo null deviceFullInfo.shouldBeNull()
verify { fakeActiveSessionHolder.instance.getSafeActiveSession() } verify { fakeActiveSessionHolder.instance.getSafeActiveSession() }
} }