From 010f2c458c3afc49800e9c9e8d476e8206af6bc3 Mon Sep 17 00:00:00 2001 From: Florian Renaud Date: Wed, 5 Oct 2022 14:48:59 +0200 Subject: [PATCH] Replace deprecated MvRxTestRule with MavericksTestRule --- docs/unit_testing.md | 2 +- .../java/im/vector/app/features/MemberListViewModelTest.kt | 4 ++-- .../crypto/quads/SharedSecureStorageViewModelTest.kt | 4 ++-- .../location/live/map/LiveLocationMapViewModelTest.kt | 4 ++-- .../app/features/onboarding/OnboardingViewModelTest.kt | 4 ++-- .../pin/lockscreen/fragment/LockScreenViewModelTests.kt | 6 +++--- .../app/features/poll/create/CreatePollViewModelTest.kt | 4 ++-- .../features/settings/devices/v2/DevicesViewModelTest.kt | 4 ++-- .../devices/v2/details/SessionDetailsViewModelTest.kt | 4 ++-- .../devices/v2/overview/SessionOverviewViewModelTest.kt | 4 ++-- .../devices/v2/rename/RenameSessionViewModelTest.kt | 4 ++-- .../features/settings/font/FontScaleSettingViewModelTest.kt | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/unit_testing.md b/docs/unit_testing.md index f786c9a160..95b78c7f5f 100644 --- a/docs/unit_testing.md +++ b/docs/unit_testing.md @@ -314,7 +314,7 @@ class ViewModelTest { private var initialState = ViewState.Empty @get:Rule - val mvrxTestRule = MvRxTestRule(testDispatcher = UnconfinedTestDispatcher()) + val mavericksTestRule = MavericksTestRule(testDispatcher = UnconfinedTestDispatcher()) @Test fun `when handling MyAction, then emits Loading and Content states`() { diff --git a/vector/src/test/java/im/vector/app/features/MemberListViewModelTest.kt b/vector/src/test/java/im/vector/app/features/MemberListViewModelTest.kt index 5cad1fbc39..f8d4b1e698 100644 --- a/vector/src/test/java/im/vector/app/features/MemberListViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/MemberListViewModelTest.kt @@ -18,7 +18,7 @@ package im.vector.app.features import androidx.arch.core.executor.testing.InstantTaskExecutorRule 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.members.RoomMemberListViewModel import im.vector.app.features.roomprofile.members.RoomMemberListViewState @@ -52,7 +52,7 @@ import org.matrix.android.sdk.api.util.Optional class MemberListViewModelTest { @get:Rule - val mvrxTestRule = MvRxTestRule() + val mavericksTestRule = MavericksTestRule() @get:Rule val instantExecutorRule = InstantTaskExecutorRule() diff --git a/vector/src/test/java/im/vector/app/features/crypto/quads/SharedSecureStorageViewModelTest.kt b/vector/src/test/java/im/vector/app/features/crypto/quads/SharedSecureStorageViewModelTest.kt index e5426c0d9d..b1f893b164 100644 --- a/vector/src/test/java/im/vector/app/features/crypto/quads/SharedSecureStorageViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/crypto/quads/SharedSecureStorageViewModelTest.kt @@ -17,7 +17,7 @@ package im.vector.app.features.crypto.quads 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.FakeStringProvider import im.vector.app.test.test @@ -42,7 +42,7 @@ private val KEY_INFO_WITHOUT_PASSPHRASE = KeyInfo(id = "id", content = SecretSto class SharedSecureStorageViewModelTest { @get:Rule - val mvrxTestRule = MvRxTestRule() + val mavericksTestRule = MavericksTestRule() private val stringProvider = FakeStringProvider() private val fakeSession = FakeSession() diff --git a/vector/src/test/java/im/vector/app/features/location/live/map/LiveLocationMapViewModelTest.kt b/vector/src/test/java/im/vector/app/features/location/live/map/LiveLocationMapViewModelTest.kt index fca5db14cc..fef0f55530 100644 --- a/vector/src/test/java/im/vector/app/features/location/live/map/LiveLocationMapViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/location/live/map/LiveLocationMapViewModelTest.kt @@ -16,7 +16,7 @@ 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.live.StopLiveLocationShareUseCase import im.vector.app.test.fakes.FakeLocationSharingServiceConnection @@ -37,7 +37,7 @@ private const val A_ROOM_ID = "room_id" class LiveLocationMapViewModelTest { @get:Rule - val mvRxTestRule = MvRxTestRule(testDispatcher = UnconfinedTestDispatcher()) + val mavericksTestRule = MavericksTestRule(testDispatcher = UnconfinedTestDispatcher()) private val args = LiveLocationMapViewArgs(roomId = A_ROOM_ID) diff --git a/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt b/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt index 49c3f3ef23..c3f6b86cb4 100644 --- a/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/onboarding/OnboardingViewModelTest.kt @@ -18,7 +18,7 @@ package im.vector.app.features.onboarding import android.net.Uri 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.features.login.LoginConfig import im.vector.app.features.login.LoginMode @@ -96,7 +96,7 @@ private val SSO_REGISTRATION_DESCRIPTION = AuthenticationDescription.Register(Au class OnboardingViewModelTest { @get:Rule - val mvrxTestRule = MvRxTestRule() + val mavericksTestRule = MavericksTestRule() private val fakeUri = FakeUri() private val fakeContext = FakeContext() diff --git a/vector/src/test/java/im/vector/app/features/pin/lockscreen/fragment/LockScreenViewModelTests.kt b/vector/src/test/java/im/vector/app/features/pin/lockscreen/fragment/LockScreenViewModelTests.kt index 6037d9933e..8f436444c4 100644 --- a/vector/src/test/java/im/vector/app/features/pin/lockscreen/fragment/LockScreenViewModelTests.kt +++ b/vector/src/test/java/im/vector/app/features/pin/lockscreen/fragment/LockScreenViewModelTests.kt @@ -21,7 +21,7 @@ import android.os.Build import android.security.keystore.KeyPermanentlyInvalidatedException import androidx.biometric.BiometricPrompt import androidx.fragment.app.FragmentActivity -import com.airbnb.mvrx.test.MvRxTestRule +import com.airbnb.mvrx.test.MavericksTestRule import com.airbnb.mvrx.withState import im.vector.app.features.pin.lockscreen.biometrics.BiometricAuthError import im.vector.app.features.pin.lockscreen.biometrics.BiometricHelper @@ -54,7 +54,7 @@ import org.junit.Test class LockScreenViewModelTests { @get:Rule - val mvrxTestRule = MvRxTestRule() + val mavericksTestRule = MavericksTestRule() private val pinCodeHelper = mockk(relaxed = true) private val biometricHelper = mockk(relaxed = true) @@ -295,7 +295,7 @@ class LockScreenViewModelTests { test.assertEvents(LockScreenViewEvent.ShowBiometricKeyInvalidatedMessage) } - private fun createViewState( + private fun createViewState( lockScreenConfiguration: LockScreenConfiguration = createDefaultConfiguration(), canUseBiometricAuth: Boolean = false, showBiometricPromptAutomatically: Boolean = false, diff --git a/vector/src/test/java/im/vector/app/features/poll/create/CreatePollViewModelTest.kt b/vector/src/test/java/im/vector/app/features/poll/create/CreatePollViewModelTest.kt index 0387fc8986..491834db5b 100644 --- a/vector/src/test/java/im/vector/app/features/poll/create/CreatePollViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/poll/create/CreatePollViewModelTest.kt @@ -16,7 +16,7 @@ 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.test.fakes.FakeCreatePollViewStates.A_FAKE_OPTIONS import im.vector.app.test.fakes.FakeCreatePollViewStates.A_FAKE_QUESTION @@ -48,7 +48,7 @@ class CreatePollViewModelTest { private val testDispatcher = UnconfinedTestDispatcher() @get:Rule - val mvRxTestRule = MvRxTestRule( + val mavericksTestRule = MavericksTestRule( testDispatcher = testDispatcher // See https://github.com/airbnb/mavericks/issues/599 ) diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt index abf3c0ade1..c68394e7d7 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/DevicesViewModelTest.kt @@ -18,7 +18,7 @@ package im.vector.app.features.settings.devices.v2 import android.os.SystemClock 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.verification.CheckIfCurrentSessionCanBeVerifiedUseCase 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 { @get:Rule - val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher) + val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher) private val fakeActiveSessionHolder = FakeActiveSessionHolder() private val getCurrentSessionCrossSigningInfoUseCase = mockk() diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/details/SessionDetailsViewModelTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/details/SessionDetailsViewModelTest.kt index df0613e06b..572f39af31 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/details/SessionDetailsViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/details/SessionDetailsViewModelTest.kt @@ -17,7 +17,7 @@ package im.vector.app.features.settings.devices.v2.details 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.features.settings.devices.v2.DeviceFullInfo import im.vector.app.features.settings.devices.v2.overview.GetDeviceFullInfoUseCase @@ -39,7 +39,7 @@ private const val A_TEXT = "text" class SessionDetailsViewModelTest { @get:Rule - val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher) + val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher) private val args = SessionDetailsArgs( deviceId = A_SESSION_ID diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt index 4f3cc66d63..3454b41ee0 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/overview/SessionOverviewViewModelTest.kt @@ -18,7 +18,7 @@ package im.vector.app.features.settings.devices.v2.overview import android.os.SystemClock 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.features.settings.devices.v2.DeviceFullInfo import im.vector.app.features.settings.devices.v2.RefreshDevicesUseCase @@ -67,7 +67,7 @@ private const val A_PASSWORD = "password" class SessionOverviewViewModelTest { @get:Rule - val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher) + val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher) private val args = SessionOverviewArgs( deviceId = A_SESSION_ID_1 diff --git a/vector/src/test/java/im/vector/app/features/settings/devices/v2/rename/RenameSessionViewModelTest.kt b/vector/src/test/java/im/vector/app/features/settings/devices/v2/rename/RenameSessionViewModelTest.kt index c14f2f3526..8bb6c3119d 100644 --- a/vector/src/test/java/im/vector/app/features/settings/devices/v2/rename/RenameSessionViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/devices/v2/rename/RenameSessionViewModelTest.kt @@ -16,7 +16,7 @@ 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.overview.GetDeviceFullInfoUseCase import im.vector.app.test.test @@ -36,7 +36,7 @@ private const val AN_EDITED_SESSION_NAME = "edited-session-name" class RenameSessionViewModelTest { @get:Rule - val mvRxTestRule = MvRxTestRule(testDispatcher = testDispatcher) + val mavericksTestRule = MavericksTestRule(testDispatcher = testDispatcher) private val args = RenameSessionArgs( deviceId = A_SESSION_ID diff --git a/vector/src/test/java/im/vector/app/features/settings/font/FontScaleSettingViewModelTest.kt b/vector/src/test/java/im/vector/app/features/settings/font/FontScaleSettingViewModelTest.kt index f21cc86572..96cf6a3b52 100644 --- a/vector/src/test/java/im/vector/app/features/settings/font/FontScaleSettingViewModelTest.kt +++ b/vector/src/test/java/im/vector/app/features/settings/font/FontScaleSettingViewModelTest.kt @@ -16,7 +16,7 @@ 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.test.fakes.FakeConfiguration import im.vector.app.test.fakes.FakeFontScalePreferences @@ -38,7 +38,7 @@ private fun aFontScaleValue(index: Int) = FontScaleValue(index, "foo", -1f, 0) class FontScaleSettingViewModelTest { @get:Rule - val mvrxTestRule = MvRxTestRule() + val mavericksTestRule = MavericksTestRule() private val fakeConfiguration = FakeConfiguration() private val fakeFontScalePreferences = FakeFontScalePreferences()