Replace deprecated MvRxTestRule with MavericksTestRule

This commit is contained in:
Florian Renaud 2022-10-05 14:48:59 +02:00
parent 8c35a8cf6b
commit 010f2c458c
12 changed files with 24 additions and 24 deletions

View file

@ -314,7 +314,7 @@ class ViewModelTest {
private var initialState = ViewState.Empty private var initialState = ViewState.Empty
@get:Rule @get:Rule
val mvrxTestRule = MvRxTestRule(testDispatcher = UnconfinedTestDispatcher()) val mavericksTestRule = MavericksTestRule(testDispatcher = UnconfinedTestDispatcher())
@Test @Test
fun `when handling MyAction, then emits Loading and Content states`() { fun `when handling MyAction, then emits Loading and Content states`() {

View file

@ -18,7 +18,7 @@ package im.vector.app.features
import androidx.arch.core.executor.testing.InstantTaskExecutorRule import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.roomprofile.RoomProfileArgs import im.vector.app.features.roomprofile.RoomProfileArgs
import im.vector.app.features.roomprofile.members.RoomMemberListViewModel import im.vector.app.features.roomprofile.members.RoomMemberListViewModel
import im.vector.app.features.roomprofile.members.RoomMemberListViewState import im.vector.app.features.roomprofile.members.RoomMemberListViewState
@ -52,7 +52,7 @@ import org.matrix.android.sdk.api.util.Optional
class MemberListViewModelTest { class MemberListViewModelTest {
@get:Rule @get:Rule
val mvrxTestRule = MvRxTestRule() val mavericksTestRule = MavericksTestRule()
@get:Rule @get:Rule
val instantExecutorRule = InstantTaskExecutorRule() val instantExecutorRule = InstantTaskExecutorRule()

View file

@ -17,7 +17,7 @@
package im.vector.app.features.crypto.quads package im.vector.app.features.crypto.quads
import com.airbnb.mvrx.Uninitialized import com.airbnb.mvrx.Uninitialized
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.test.fakes.FakeSession import im.vector.app.test.fakes.FakeSession
import im.vector.app.test.fakes.FakeStringProvider import im.vector.app.test.fakes.FakeStringProvider
import im.vector.app.test.test import im.vector.app.test.test
@ -42,7 +42,7 @@ private val KEY_INFO_WITHOUT_PASSPHRASE = KeyInfo(id = "id", content = SecretSto
class SharedSecureStorageViewModelTest { class SharedSecureStorageViewModelTest {
@get:Rule @get:Rule
val mvrxTestRule = MvRxTestRule() val mavericksTestRule = MavericksTestRule()
private val stringProvider = FakeStringProvider() private val stringProvider = FakeStringProvider()
private val fakeSession = FakeSession() private val fakeSession = FakeSession()

View file

@ -16,7 +16,7 @@
package im.vector.app.features.location.live.map package im.vector.app.features.location.live.map
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.location.LocationData import im.vector.app.features.location.LocationData
import im.vector.app.features.location.live.StopLiveLocationShareUseCase import im.vector.app.features.location.live.StopLiveLocationShareUseCase
import im.vector.app.test.fakes.FakeLocationSharingServiceConnection import im.vector.app.test.fakes.FakeLocationSharingServiceConnection
@ -37,7 +37,7 @@ private const val A_ROOM_ID = "room_id"
class LiveLocationMapViewModelTest { class LiveLocationMapViewModelTest {
@get:Rule @get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = UnconfinedTestDispatcher()) val mavericksTestRule = MavericksTestRule(testDispatcher = UnconfinedTestDispatcher())
private val args = LiveLocationMapViewArgs(roomId = A_ROOM_ID) private val args = LiveLocationMapViewArgs(roomId = A_ROOM_ID)

View file

@ -18,7 +18,7 @@ package im.vector.app.features.onboarding
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.R import im.vector.app.R
import im.vector.app.features.login.LoginConfig import im.vector.app.features.login.LoginConfig
import im.vector.app.features.login.LoginMode import im.vector.app.features.login.LoginMode
@ -96,7 +96,7 @@ private val SSO_REGISTRATION_DESCRIPTION = AuthenticationDescription.Register(Au
class OnboardingViewModelTest { class OnboardingViewModelTest {
@get:Rule @get:Rule
val mvrxTestRule = MvRxTestRule() val mavericksTestRule = MavericksTestRule()
private val fakeUri = FakeUri() private val fakeUri = FakeUri()
private val fakeContext = FakeContext() private val fakeContext = FakeContext()

View file

@ -21,7 +21,7 @@ import android.os.Build
import android.security.keystore.KeyPermanentlyInvalidatedException import android.security.keystore.KeyPermanentlyInvalidatedException
import androidx.biometric.BiometricPrompt import androidx.biometric.BiometricPrompt
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import im.vector.app.features.pin.lockscreen.biometrics.BiometricAuthError import im.vector.app.features.pin.lockscreen.biometrics.BiometricAuthError
import im.vector.app.features.pin.lockscreen.biometrics.BiometricHelper import im.vector.app.features.pin.lockscreen.biometrics.BiometricHelper
@ -54,7 +54,7 @@ import org.junit.Test
class LockScreenViewModelTests { class LockScreenViewModelTests {
@get:Rule @get:Rule
val mvrxTestRule = MvRxTestRule() val mavericksTestRule = MavericksTestRule()
private val pinCodeHelper = mockk<PinCodeHelper>(relaxed = true) private val pinCodeHelper = mockk<PinCodeHelper>(relaxed = true)
private val biometricHelper = mockk<BiometricHelper>(relaxed = true) private val biometricHelper = mockk<BiometricHelper>(relaxed = true)
@ -295,7 +295,7 @@ class LockScreenViewModelTests {
test.assertEvents(LockScreenViewEvent.ShowBiometricKeyInvalidatedMessage) test.assertEvents(LockScreenViewEvent.ShowBiometricKeyInvalidatedMessage)
} }
private fun createViewState( private fun createViewState(
lockScreenConfiguration: LockScreenConfiguration = createDefaultConfiguration(), lockScreenConfiguration: LockScreenConfiguration = createDefaultConfiguration(),
canUseBiometricAuth: Boolean = false, canUseBiometricAuth: Boolean = false,
showBiometricPromptAutomatically: Boolean = false, showBiometricPromptAutomatically: Boolean = false,

View file

@ -16,7 +16,7 @@
package im.vector.app.features.poll.create package im.vector.app.features.poll.create
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.poll.PollMode import im.vector.app.features.poll.PollMode
import im.vector.app.test.fakes.FakeCreatePollViewStates.A_FAKE_OPTIONS import im.vector.app.test.fakes.FakeCreatePollViewStates.A_FAKE_OPTIONS
import im.vector.app.test.fakes.FakeCreatePollViewStates.A_FAKE_QUESTION import im.vector.app.test.fakes.FakeCreatePollViewStates.A_FAKE_QUESTION
@ -48,7 +48,7 @@ class CreatePollViewModelTest {
private val testDispatcher = UnconfinedTestDispatcher() private val testDispatcher = UnconfinedTestDispatcher()
@get:Rule @get:Rule
val mvRxTestRule = MvRxTestRule( val mavericksTestRule = MavericksTestRule(
testDispatcher = testDispatcher // See https://github.com/airbnb/mavericks/issues/599 testDispatcher = testDispatcher // See https://github.com/airbnb/mavericks/issues/599
) )

View file

@ -18,7 +18,7 @@ package im.vector.app.features.settings.devices.v2
import android.os.SystemClock import android.os.SystemClock
import com.airbnb.mvrx.Success import com.airbnb.mvrx.Success
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.settings.devices.v2.list.DeviceType import im.vector.app.features.settings.devices.v2.list.DeviceType
import im.vector.app.features.settings.devices.v2.verification.CheckIfCurrentSessionCanBeVerifiedUseCase import im.vector.app.features.settings.devices.v2.verification.CheckIfCurrentSessionCanBeVerifiedUseCase
import im.vector.app.features.settings.devices.v2.verification.CurrentSessionCrossSigningInfo import im.vector.app.features.settings.devices.v2.verification.CurrentSessionCrossSigningInfo
@ -48,7 +48,7 @@ import org.matrix.android.sdk.api.session.crypto.model.RoomEncryptionTrustLevel
class DevicesViewModelTest { class DevicesViewModelTest {
@get:Rule @get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher) val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher)
private val fakeActiveSessionHolder = FakeActiveSessionHolder() private val fakeActiveSessionHolder = FakeActiveSessionHolder()
private val getCurrentSessionCrossSigningInfoUseCase = mockk<GetCurrentSessionCrossSigningInfoUseCase>() private val getCurrentSessionCrossSigningInfoUseCase = mockk<GetCurrentSessionCrossSigningInfoUseCase>()

View file

@ -17,7 +17,7 @@
package im.vector.app.features.settings.devices.v2.details package im.vector.app.features.settings.devices.v2.details
import com.airbnb.mvrx.Success import com.airbnb.mvrx.Success
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.core.utils.CopyToClipboardUseCase import im.vector.app.core.utils.CopyToClipboardUseCase
import im.vector.app.features.settings.devices.v2.DeviceFullInfo import im.vector.app.features.settings.devices.v2.DeviceFullInfo
import im.vector.app.features.settings.devices.v2.overview.GetDeviceFullInfoUseCase import im.vector.app.features.settings.devices.v2.overview.GetDeviceFullInfoUseCase
@ -39,7 +39,7 @@ private const val A_TEXT = "text"
class SessionDetailsViewModelTest { class SessionDetailsViewModelTest {
@get:Rule @get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher) val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher)
private val args = SessionDetailsArgs( private val args = SessionDetailsArgs(
deviceId = A_SESSION_ID deviceId = A_SESSION_ID

View file

@ -18,7 +18,7 @@ package im.vector.app.features.settings.devices.v2.overview
import android.os.SystemClock import android.os.SystemClock
import com.airbnb.mvrx.Success import com.airbnb.mvrx.Success
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.R import im.vector.app.R
import im.vector.app.features.settings.devices.v2.DeviceFullInfo import im.vector.app.features.settings.devices.v2.DeviceFullInfo
import im.vector.app.features.settings.devices.v2.RefreshDevicesUseCase import im.vector.app.features.settings.devices.v2.RefreshDevicesUseCase
@ -67,7 +67,7 @@ private const val A_PASSWORD = "password"
class SessionOverviewViewModelTest { class SessionOverviewViewModelTest {
@get:Rule @get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher) val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher)
private val args = SessionOverviewArgs( private val args = SessionOverviewArgs(
deviceId = A_SESSION_ID_1 deviceId = A_SESSION_ID_1

View file

@ -16,7 +16,7 @@
package im.vector.app.features.settings.devices.v2.rename package im.vector.app.features.settings.devices.v2.rename
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.settings.devices.v2.DeviceFullInfo import im.vector.app.features.settings.devices.v2.DeviceFullInfo
import im.vector.app.features.settings.devices.v2.overview.GetDeviceFullInfoUseCase import im.vector.app.features.settings.devices.v2.overview.GetDeviceFullInfoUseCase
import im.vector.app.test.test import im.vector.app.test.test
@ -36,7 +36,7 @@ private const val AN_EDITED_SESSION_NAME = "edited-session-name"
class RenameSessionViewModelTest { class RenameSessionViewModelTest {
@get:Rule @get:Rule
val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher) val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher)
private val args = RenameSessionArgs( private val args = RenameSessionArgs(
deviceId = A_SESSION_ID deviceId = A_SESSION_ID

View file

@ -16,7 +16,7 @@
package im.vector.app.features.settings.font package im.vector.app.features.settings.font
import com.airbnb.mvrx.test.MvRxTestRule import com.airbnb.mvrx.test.MavericksTestRule
import im.vector.app.features.settings.FontScaleValue import im.vector.app.features.settings.FontScaleValue
import im.vector.app.test.fakes.FakeConfiguration import im.vector.app.test.fakes.FakeConfiguration
import im.vector.app.test.fakes.FakeFontScalePreferences import im.vector.app.test.fakes.FakeFontScalePreferences
@ -38,7 +38,7 @@ private fun aFontScaleValue(index: Int) = FontScaleValue(index, "foo", -1f, 0)
class FontScaleSettingViewModelTest { class FontScaleSettingViewModelTest {
@get:Rule @get:Rule
val mvrxTestRule = MvRxTestRule() val mavericksTestRule = MavericksTestRule()
private val fakeConfiguration = FakeConfiguration() private val fakeConfiguration = FakeConfiguration()
private val fakeFontScalePreferences = FakeFontScalePreferences() private val fakeFontScalePreferences = FakeFontScalePreferences()