From 882020fdba8c7e10ef24a073f663e0a4783ecfbb Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 4 Dec 2023 15:54:17 +0100 Subject: [PATCH] Fix test compilation issue. --- .../app/core/pushers/PushersManagerTest.kt | 2 ++ .../vector/app/features/mdm/NoOpMdmService.kt | 25 +++++++++++++++++++ .../onboarding/OnboardingViewModelTest.kt | 2 ++ 3 files changed, 29 insertions(+) create mode 100644 vector/src/test/java/im/vector/app/features/mdm/NoOpMdmService.kt 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 4b6063fb93..48850c13c5 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 @@ -17,6 +17,7 @@ package im.vector.app.core.pushers import im.vector.app.R +import im.vector.app.features.mdm.NoOpMdmService import im.vector.app.test.fakes.FakeActiveSessionHolder import im.vector.app.test.fakes.FakeAppNameProvider import im.vector.app.test.fakes.FakeGetDeviceInfoUseCase @@ -54,6 +55,7 @@ class PushersManagerTest { stringProvider.instance, appNameProvider, getDeviceInfoUseCase, + NoOpMdmService(), ) @Test diff --git a/vector/src/test/java/im/vector/app/features/mdm/NoOpMdmService.kt b/vector/src/test/java/im/vector/app/features/mdm/NoOpMdmService.kt new file mode 100644 index 0000000000..a8531d8c7f --- /dev/null +++ b/vector/src/test/java/im/vector/app/features/mdm/NoOpMdmService.kt @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2023 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.mdm + +import android.content.Context + +class NoOpMdmService : MdmService { + override fun registerListener(context: Context, onChangedListener: () -> Unit) = Unit + override fun unregisterListener(context: Context) = Unit + override fun getData(mdmData: MdmData): String? = null +} 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 a4afab8488..918452b6af 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 @@ -26,6 +26,7 @@ import im.vector.app.features.login.LoginMode import im.vector.app.features.login.ReAuthHelper import im.vector.app.features.login.ServerType import im.vector.app.features.login.SignMode +import im.vector.app.features.mdm.NoOpMdmService import im.vector.app.features.onboarding.RegistrationStateFixture.aRegistrationState import im.vector.app.features.onboarding.StartAuthenticationFlowUseCase.StartAuthenticationResult import im.vector.app.test.TestBuildVersionSdkIntProvider @@ -1121,6 +1122,7 @@ class OnboardingViewModelTest { fakeRegistrationActionHandler.instance, TestBuildVersionSdkIntProvider().also { it.value = Build.VERSION_CODES.O }, fakeConfigureAndStartSessionUseCase, + NoOpMdmService() ).also { viewModel = it initialState = state