diff --git a/appnav/src/test/kotlin/io/element/android/appnav/di/MatrixClientsHolderTest.kt b/appnav/src/test/kotlin/io/element/android/appnav/di/MatrixClientsHolderTest.kt index 6dce8a6310..4fb518b058 100644 --- a/appnav/src/test/kotlin/io/element/android/appnav/di/MatrixClientsHolderTest.kt +++ b/appnav/src/test/kotlin/io/element/android/appnav/di/MatrixClientsHolderTest.kt @@ -20,21 +20,21 @@ import com.bumble.appyx.core.state.MutableSavedStateMapImpl import com.google.common.truth.Truth.assertThat import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.FakeMatrixClient -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import kotlinx.coroutines.test.runTest import org.junit.Test class MatrixClientsHolderTest { @Test fun `test getOrNull`() { - val fakeAuthenticationService = FakeAuthenticationService() + val fakeAuthenticationService = FakeMatrixAuthenticationService() val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService) assertThat(matrixClientsHolder.getOrNull(A_SESSION_ID)).isNull() } @Test fun `test getOrRestore`() = runTest { - val fakeAuthenticationService = FakeAuthenticationService() + val fakeAuthenticationService = FakeMatrixAuthenticationService() val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService) val fakeMatrixClient = FakeMatrixClient() fakeAuthenticationService.givenMatrixClient(fakeMatrixClient) @@ -47,7 +47,7 @@ class MatrixClientsHolderTest { @Test fun `test remove`() = runTest { - val fakeAuthenticationService = FakeAuthenticationService() + val fakeAuthenticationService = FakeMatrixAuthenticationService() val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService) val fakeMatrixClient = FakeMatrixClient() fakeAuthenticationService.givenMatrixClient(fakeMatrixClient) @@ -60,7 +60,7 @@ class MatrixClientsHolderTest { @Test fun `test remove all`() = runTest { - val fakeAuthenticationService = FakeAuthenticationService() + val fakeAuthenticationService = FakeMatrixAuthenticationService() val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService) val fakeMatrixClient = FakeMatrixClient() fakeAuthenticationService.givenMatrixClient(fakeMatrixClient) @@ -73,7 +73,7 @@ class MatrixClientsHolderTest { @Test fun `test save and restore`() = runTest { - val fakeAuthenticationService = FakeAuthenticationService() + val fakeAuthenticationService = FakeMatrixAuthenticationService() val matrixClientsHolder = MatrixClientsHolder(fakeAuthenticationService) val fakeMatrixClient = FakeMatrixClient() fakeAuthenticationService.givenMatrixClient(fakeMatrixClient) diff --git a/features/lockscreen/impl/src/test/kotlin/io/element/android/features/lockscreen/impl/unlock/DefaultSignOutTest.kt b/features/lockscreen/impl/src/test/kotlin/io/element/android/features/lockscreen/impl/unlock/DefaultSignOutTest.kt index 6870a336d3..392693d9ef 100644 --- a/features/lockscreen/impl/src/test/kotlin/io/element/android/features/lockscreen/impl/unlock/DefaultSignOutTest.kt +++ b/features/lockscreen/impl/src/test/kotlin/io/element/android/features/lockscreen/impl/unlock/DefaultSignOutTest.kt @@ -20,7 +20,7 @@ import com.google.common.truth.Truth.assertThat import io.element.android.features.lockscreen.impl.unlock.signout.DefaultSignOut import io.element.android.libraries.matrix.test.FakeMatrixClient import io.element.android.libraries.matrix.test.FakeMatrixClientProvider -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.tests.testutils.lambda.assert import io.element.android.tests.testutils.lambda.lambdaRecorder import kotlinx.coroutines.test.runTest @@ -28,7 +28,7 @@ import org.junit.Test class DefaultSignOutTest { private val matrixClient = FakeMatrixClient() - private val authenticationService = FakeAuthenticationService() + private val authenticationService = FakeMatrixAuthenticationService() private val matrixClientProvider = FakeMatrixClientProvider(getClient = { Result.success(matrixClient) }) private val sut = DefaultSignOut(authenticationService, matrixClientProvider) diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt index f8518f6033..e6969921f3 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/changeserver/ChangeServerPresenterTest.kt @@ -25,7 +25,7 @@ import io.element.android.features.login.impl.accountprovider.AccountProviderDat import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.test.A_HOMESERVER import io.element.android.libraries.matrix.test.A_HOMESERVER_URL -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.tests.testutils.WarmUpRule import kotlinx.coroutines.test.runTest import org.junit.Rule @@ -38,7 +38,7 @@ class ChangeServerPresenterTest { @Test fun `present - initial state`() = runTest { val presenter = ChangeServerPresenter( - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), AccountProviderDataSource() ) moleculeFlow(RecompositionMode.Immediate) { @@ -51,7 +51,7 @@ class ChangeServerPresenterTest { @Test fun `present - change server ok`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val presenter = ChangeServerPresenter( authenticationService, AccountProviderDataSource() @@ -72,7 +72,7 @@ class ChangeServerPresenterTest { @Test fun `present - change server error`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val presenter = ChangeServerPresenter( authenticationService, AccountProviderDataSource() diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/oidc/webview/OidcPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/oidc/webview/OidcPresenterTest.kt index 34b497866a..38d0506dd8 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/oidc/webview/OidcPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/oidc/webview/OidcPresenterTest.kt @@ -26,7 +26,7 @@ import io.element.android.features.login.api.oidc.OidcAction import io.element.android.libraries.architecture.AsyncAction import io.element.android.libraries.matrix.test.A_THROWABLE import io.element.android.libraries.matrix.test.auth.A_OIDC_DATA -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.tests.testutils.WarmUpRule import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest @@ -41,7 +41,7 @@ class OidcPresenterTest { fun `present - initial state`() = runTest { val presenter = OidcPresenter( A_OIDC_DATA, - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), ) moleculeFlow(RecompositionMode.Immediate) { presenter.present() @@ -56,7 +56,7 @@ class OidcPresenterTest { fun `present - go back`() = runTest { val presenter = OidcPresenter( A_OIDC_DATA, - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), ) moleculeFlow(RecompositionMode.Immediate) { presenter.present() @@ -72,7 +72,7 @@ class OidcPresenterTest { @Test fun `present - go back with failure`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val presenter = OidcPresenter( A_OIDC_DATA, authenticationService, @@ -95,7 +95,7 @@ class OidcPresenterTest { fun `present - user cancels from webview`() = runTest { val presenter = OidcPresenter( A_OIDC_DATA, - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), ) moleculeFlow(RecompositionMode.Immediate) { presenter.present() @@ -113,7 +113,7 @@ class OidcPresenterTest { fun `present - login success`() = runTest { val presenter = OidcPresenter( A_OIDC_DATA, - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), ) moleculeFlow(RecompositionMode.Immediate) { presenter.present() @@ -128,7 +128,7 @@ class OidcPresenterTest { @Test fun `present - login error`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val presenter = OidcPresenter( A_OIDC_DATA, authenticationService, diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenterTest.kt index 04680ede17..f7696652d0 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/changeaccountprovider/ChangeAccountProviderPresenterTest.kt @@ -23,7 +23,7 @@ import com.google.common.truth.Truth.assertThat import io.element.android.features.login.impl.accountprovider.AccountProvider import io.element.android.features.login.impl.accountprovider.AccountProviderDataSource import io.element.android.features.login.impl.changeserver.ChangeServerPresenter -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.tests.testutils.WarmUpRule import kotlinx.coroutines.test.runTest import org.junit.Rule @@ -36,7 +36,7 @@ class ChangeAccountProviderPresenterTest { @Test fun `present - initial state`() = runTest { val changeServerPresenter = ChangeServerPresenter( - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), AccountProviderDataSource() ) val presenter = ChangeAccountProviderPresenter( diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt index 57f18d7eb4..5a02797bdb 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/confirmaccountprovider/ConfirmAccountProviderPresenterTest.kt @@ -30,7 +30,7 @@ import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService import io.element.android.libraries.matrix.test.A_HOMESERVER import io.element.android.libraries.matrix.test.A_HOMESERVER_OIDC import io.element.android.libraries.matrix.test.A_THROWABLE -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.waitForPredicate import kotlinx.coroutines.test.runTest @@ -57,7 +57,7 @@ class ConfirmAccountProviderPresenterTest { @Test fun `present - continue password login`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val presenter = createConfirmAccountProviderPresenter( matrixAuthenticationService = authenticationService, ) @@ -79,7 +79,7 @@ class ConfirmAccountProviderPresenterTest { @Test fun `present - continue oidc`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val presenter = createConfirmAccountProviderPresenter( matrixAuthenticationService = authenticationService, ) @@ -101,7 +101,7 @@ class ConfirmAccountProviderPresenterTest { @Test fun `present - oidc - cancel with failure`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val defaultOidcActionFlow = DefaultOidcActionFlow() val presenter = createConfirmAccountProviderPresenter( matrixAuthenticationService = authenticationService, @@ -129,7 +129,7 @@ class ConfirmAccountProviderPresenterTest { @Test fun `present - oidc - cancel with success`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val defaultOidcActionFlow = DefaultOidcActionFlow() val presenter = createConfirmAccountProviderPresenter( matrixAuthenticationService = authenticationService, @@ -156,7 +156,7 @@ class ConfirmAccountProviderPresenterTest { @Test fun `present - oidc - success with failure`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val defaultOidcActionFlow = DefaultOidcActionFlow() val presenter = createConfirmAccountProviderPresenter( matrixAuthenticationService = authenticationService, @@ -186,7 +186,7 @@ class ConfirmAccountProviderPresenterTest { @Test fun `present - oidc - success with success`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val defaultOidcActionFlow = DefaultOidcActionFlow() val defaultLoginUserStory = DefaultLoginUserStory().apply { setLoginFlowIsDone(false) @@ -219,7 +219,7 @@ class ConfirmAccountProviderPresenterTest { @Test fun `present - submit fails`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val presenter = createConfirmAccountProviderPresenter( matrixAuthenticationService = authenticationService, ) @@ -238,7 +238,7 @@ class ConfirmAccountProviderPresenterTest { @Test fun `present - clear error`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val presenter = createConfirmAccountProviderPresenter( matrixAuthenticationService = authenticationService, ) @@ -267,7 +267,7 @@ class ConfirmAccountProviderPresenterTest { private fun createConfirmAccountProviderPresenter( params: ConfirmAccountProviderPresenter.Params = ConfirmAccountProviderPresenter.Params(isAccountCreation = false), accountProviderDataSource: AccountProviderDataSource = AccountProviderDataSource(), - matrixAuthenticationService: MatrixAuthenticationService = FakeAuthenticationService(), + matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), defaultOidcActionFlow: DefaultOidcActionFlow = DefaultOidcActionFlow(), defaultLoginUserStory: DefaultLoginUserStory = DefaultLoginUserStory(), ) = ConfirmAccountProviderPresenter( diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt index 4658df0ab9..db73c25687 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/loginpassword/LoginPasswordPresenterTest.kt @@ -30,7 +30,7 @@ import io.element.android.libraries.matrix.test.A_PASSWORD import io.element.android.libraries.matrix.test.A_SESSION_ID import io.element.android.libraries.matrix.test.A_THROWABLE import io.element.android.libraries.matrix.test.A_USER_NAME -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.tests.testutils.WarmUpRule import kotlinx.coroutines.test.runTest import org.junit.Rule @@ -42,7 +42,7 @@ class LoginPasswordPresenterTest { @Test fun `present - initial state`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val accountProviderDataSource = AccountProviderDataSource() val loginUserStory = DefaultLoginUserStory() val presenter = LoginPasswordPresenter( @@ -63,7 +63,7 @@ class LoginPasswordPresenterTest { @Test fun `present - enter login and password`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val accountProviderDataSource = AccountProviderDataSource() val loginUserStory = DefaultLoginUserStory() val presenter = LoginPasswordPresenter( @@ -89,7 +89,7 @@ class LoginPasswordPresenterTest { @Test fun `present - submit`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val accountProviderDataSource = AccountProviderDataSource() val loginUserStory = DefaultLoginUserStory().apply { setLoginFlowIsDone(false) } val presenter = LoginPasswordPresenter( @@ -118,7 +118,7 @@ class LoginPasswordPresenterTest { @Test fun `present - submit with error`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val accountProviderDataSource = AccountProviderDataSource() val loginUserStory = DefaultLoginUserStory() val presenter = LoginPasswordPresenter( @@ -146,7 +146,7 @@ class LoginPasswordPresenterTest { @Test fun `present - clear error`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val accountProviderDataSource = AccountProviderDataSource() val loginUserStory = DefaultLoginUserStory() val presenter = LoginPasswordPresenter( diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenterTest.kt index 28aa1090a9..5288746583 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/searchaccountprovider/SearchAccountProviderPresenterTest.kt @@ -29,7 +29,7 @@ import io.element.android.features.login.impl.resolver.network.WellKnownBaseConf import io.element.android.features.login.impl.resolver.network.WellKnownSlidingSyncConfig import io.element.android.libraries.architecture.AsyncData import io.element.android.libraries.matrix.test.A_HOMESERVER_URL -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.tests.testutils.WarmUpRule import io.element.android.tests.testutils.testCoroutineDispatchers import kotlinx.coroutines.test.runTest @@ -44,7 +44,7 @@ class SearchAccountProviderPresenterTest { fun `present - initial state`() = runTest { val fakeWellknownRequest = FakeWellknownRequest() val changeServerPresenter = ChangeServerPresenter( - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), AccountProviderDataSource() ) val presenter = SearchAccountProviderPresenter( @@ -64,7 +64,7 @@ class SearchAccountProviderPresenterTest { fun `present - enter text no result`() = runTest { val fakeWellknownRequest = FakeWellknownRequest() val changeServerPresenter = ChangeServerPresenter( - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), AccountProviderDataSource() ) val presenter = SearchAccountProviderPresenter( @@ -88,7 +88,7 @@ class SearchAccountProviderPresenterTest { fun `present - enter valid url no wellknown`() = runTest { val fakeWellknownRequest = FakeWellknownRequest() val changeServerPresenter = ChangeServerPresenter( - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), AccountProviderDataSource() ) val presenter = SearchAccountProviderPresenter( @@ -123,7 +123,7 @@ class SearchAccountProviderPresenterTest { ) ) val changeServerPresenter = ChangeServerPresenter( - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), AccountProviderDataSource() ) val presenter = SearchAccountProviderPresenter( @@ -158,7 +158,7 @@ class SearchAccountProviderPresenterTest { ) ) val changeServerPresenter = ChangeServerPresenter( - FakeAuthenticationService(), + FakeMatrixAuthenticationService(), AccountProviderDataSource() ) val presenter = SearchAccountProviderPresenter( diff --git a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/waitlistscreen/WaitListPresenterTest.kt b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/waitlistscreen/WaitListPresenterTest.kt index f88f47ae26..4f751a5c9e 100644 --- a/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/waitlistscreen/WaitListPresenterTest.kt +++ b/features/login/impl/src/test/kotlin/io/element/android/features/login/impl/screens/waitlistscreen/WaitListPresenterTest.kt @@ -28,7 +28,7 @@ import io.element.android.libraries.matrix.test.A_HOMESERVER import io.element.android.libraries.matrix.test.A_HOMESERVER_URL import io.element.android.libraries.matrix.test.A_THROWABLE import io.element.android.libraries.matrix.test.A_USER_ID -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.tests.testutils.WarmUpRule import kotlinx.coroutines.test.runTest @@ -41,7 +41,7 @@ class WaitListPresenterTest { @Test fun `present - initial state`() = runTest { - val authenticationService = FakeAuthenticationService().apply { + val authenticationService = FakeMatrixAuthenticationService().apply { givenHomeserver(A_HOMESERVER) } val loginUserStory = DefaultLoginUserStory() @@ -63,7 +63,7 @@ class WaitListPresenterTest { @Test fun `present - attempt login with error`() = runTest { - val authenticationService = FakeAuthenticationService().apply { + val authenticationService = FakeMatrixAuthenticationService().apply { givenLoginError(A_THROWABLE) } val loginUserStory = DefaultLoginUserStory() @@ -94,7 +94,7 @@ class WaitListPresenterTest { @Test fun `present - attempt login with success`() = runTest { - val authenticationService = FakeAuthenticationService() + val authenticationService = FakeMatrixAuthenticationService() val loginUserStory = DefaultLoginUserStory().apply { setLoginFlowIsDone(false) } val presenter = WaitListPresenter( LoginFormState.Default, diff --git a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeAuthenticationService.kt b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeMatrixAuthenticationService.kt similarity index 99% rename from libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeAuthenticationService.kt rename to libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeMatrixAuthenticationService.kt index b138c55acb..9cec3cbecf 100644 --- a/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeAuthenticationService.kt +++ b/libraries/matrix/test/src/main/kotlin/io/element/android/libraries/matrix/test/auth/FakeMatrixAuthenticationService.kt @@ -31,7 +31,7 @@ import kotlinx.coroutines.flow.flowOf val A_OIDC_DATA = OidcDetails(url = "a-url") -class FakeAuthenticationService( +class FakeMatrixAuthenticationService( private val matrixClientResult: ((SessionId) -> Result)? = null ) : MatrixAuthenticationService { private val homeserver = MutableStateFlow(null) diff --git a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/push/DefaultPushHandlerTest.kt b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/push/DefaultPushHandlerTest.kt index bae296a574..7739efbd1d 100644 --- a/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/push/DefaultPushHandlerTest.kt +++ b/libraries/push/impl/src/test/kotlin/io/element/android/libraries/push/impl/push/DefaultPushHandlerTest.kt @@ -28,7 +28,7 @@ import io.element.android.libraries.matrix.test.AN_EVENT_ID import io.element.android.libraries.matrix.test.A_ROOM_ID import io.element.android.libraries.matrix.test.A_SECRET import io.element.android.libraries.matrix.test.A_USER_ID -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.libraries.matrix.test.core.aBuildMeta import io.element.android.libraries.push.impl.notifications.FakeNotifiableEventResolver import io.element.android.libraries.push.impl.notifications.fixtures.aNotifiableMessageEvent @@ -135,7 +135,7 @@ class DefaultPushHandlerTest { pushClientSecret = FakePushClientSecret( getUserIdFromSecretResult = { null } ), - matrixAuthenticationService = FakeAuthenticationService().apply { + matrixAuthenticationService = FakeMatrixAuthenticationService().apply { getLatestSessionIdLambda = { A_USER_ID } }, incrementPushCounterResult = incrementPushCounterResult @@ -171,7 +171,7 @@ class DefaultPushHandlerTest { pushClientSecret = FakePushClientSecret( getUserIdFromSecretResult = { null } ), - matrixAuthenticationService = FakeAuthenticationService().apply { + matrixAuthenticationService = FakeMatrixAuthenticationService().apply { getLatestSessionIdLambda = { null } }, incrementPushCounterResult = incrementPushCounterResult @@ -247,7 +247,7 @@ class DefaultPushHandlerTest { userPushStore: UserPushStore = FakeUserPushStore(), pushClientSecret: PushClientSecret = FakePushClientSecret(), buildMeta: BuildMeta = aBuildMeta(), - matrixAuthenticationService: MatrixAuthenticationService = FakeAuthenticationService(), + matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), diagnosticPushHandler: DiagnosticPushHandler = DiagnosticPushHandler(), ): DefaultPushHandler { return DefaultPushHandler( diff --git a/libraries/pushproviders/firebase/src/test/kotlin/io/element/android/libraries/pushproviders/firebase/DefaultFirebaseNewTokenHandlerTest.kt b/libraries/pushproviders/firebase/src/test/kotlin/io/element/android/libraries/pushproviders/firebase/DefaultFirebaseNewTokenHandlerTest.kt index af2b98ea07..585a5e2a08 100644 --- a/libraries/pushproviders/firebase/src/test/kotlin/io/element/android/libraries/pushproviders/firebase/DefaultFirebaseNewTokenHandlerTest.kt +++ b/libraries/pushproviders/firebase/src/test/kotlin/io/element/android/libraries/pushproviders/firebase/DefaultFirebaseNewTokenHandlerTest.kt @@ -25,7 +25,7 @@ import io.element.android.libraries.matrix.test.A_USER_ID import io.element.android.libraries.matrix.test.A_USER_ID_2 import io.element.android.libraries.matrix.test.A_USER_ID_3 import io.element.android.libraries.matrix.test.FakeMatrixClient -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.libraries.push.test.FakePusherSubscriber import io.element.android.libraries.pushproviders.api.PusherSubscriber import io.element.android.libraries.pushstore.api.UserPushStoreFactory @@ -66,7 +66,7 @@ class DefaultFirebaseNewTokenHandlerTest { storeData(aSessionData(A_USER_ID_2)) storeData(aSessionData(A_USER_ID_3)) }, - matrixAuthenticationService = FakeAuthenticationService( + matrixAuthenticationService = FakeMatrixAuthenticationService( matrixClientResult = { sessionId -> when (sessionId) { A_USER_ID -> Result.success(aMatrixClient1) @@ -105,7 +105,7 @@ class DefaultFirebaseNewTokenHandlerTest { sessionStore = InMemoryMultiSessionsStore().apply { storeData(aSessionData(A_USER_ID)) }, - matrixAuthenticationService = FakeAuthenticationService( + matrixAuthenticationService = FakeMatrixAuthenticationService( matrixClientResult = { _ -> Result.failure(IllegalStateException()) } @@ -131,7 +131,7 @@ class DefaultFirebaseNewTokenHandlerTest { sessionStore = InMemoryMultiSessionsStore().apply { storeData(aSessionData(A_USER_ID)) }, - matrixAuthenticationService = FakeAuthenticationService( + matrixAuthenticationService = FakeMatrixAuthenticationService( matrixClientResult = { _ -> Result.success(aMatrixClient1) } @@ -154,7 +154,7 @@ class DefaultFirebaseNewTokenHandlerTest { pusherSubscriber: PusherSubscriber = FakePusherSubscriber(), sessionStore: SessionStore = InMemorySessionStore(), userPushStoreFactory: UserPushStoreFactory = FakeUserPushStoreFactory(), - matrixAuthenticationService: MatrixAuthenticationService = FakeAuthenticationService(), + matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService(), firebaseStore: FirebaseStore = InMemoryFirebaseStore(), ): FirebaseNewTokenHandler { return DefaultFirebaseNewTokenHandler( diff --git a/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/DefaultUnifiedPushNewGatewayHandlerTest.kt b/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/DefaultUnifiedPushNewGatewayHandlerTest.kt index 3f0b7409cc..09637fcd21 100644 --- a/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/DefaultUnifiedPushNewGatewayHandlerTest.kt +++ b/libraries/pushproviders/unifiedpush/src/test/kotlin/io/element/android/libraries/pushproviders/unifiedpush/DefaultUnifiedPushNewGatewayHandlerTest.kt @@ -22,7 +22,7 @@ import io.element.android.libraries.matrix.api.auth.MatrixAuthenticationService import io.element.android.libraries.matrix.test.A_SECRET import io.element.android.libraries.matrix.test.A_USER_ID import io.element.android.libraries.matrix.test.FakeMatrixClient -import io.element.android.libraries.matrix.test.auth.FakeAuthenticationService +import io.element.android.libraries.matrix.test.auth.FakeMatrixAuthenticationService import io.element.android.libraries.push.test.FakePusherSubscriber import io.element.android.libraries.pushproviders.api.PusherSubscriber import io.element.android.libraries.pushstore.api.UserPushStoreFactory @@ -86,7 +86,7 @@ class DefaultUnifiedPushNewGatewayHandlerTest { pusherSubscriber = FakePusherSubscriber( registerPusherResult = { _, _, _ -> Result.failure(IllegalStateException("an error")) } ), - matrixAuthenticationService = FakeAuthenticationService(matrixClientResult = { Result.success(aMatrixClient) }), + matrixAuthenticationService = FakeMatrixAuthenticationService(matrixClientResult = { Result.success(aMatrixClient) }), ) val result = defaultUnifiedPushNewGatewayHandler.handle( endpoint = "aEndpoint", @@ -114,7 +114,7 @@ class DefaultUnifiedPushNewGatewayHandlerTest { pusherSubscriber = FakePusherSubscriber( registerPusherResult = lambda ), - matrixAuthenticationService = FakeAuthenticationService(matrixClientResult = { Result.success(aMatrixClient) }), + matrixAuthenticationService = FakeMatrixAuthenticationService(matrixClientResult = { Result.success(aMatrixClient) }), ) val result = defaultUnifiedPushNewGatewayHandler.handle( endpoint = "aEndpoint", @@ -131,7 +131,7 @@ class DefaultUnifiedPushNewGatewayHandlerTest { pusherSubscriber: PusherSubscriber = FakePusherSubscriber(), userPushStoreFactory: UserPushStoreFactory = FakeUserPushStoreFactory(), pushClientSecret: PushClientSecret = FakePushClientSecret(), - matrixAuthenticationService: MatrixAuthenticationService = FakeAuthenticationService() + matrixAuthenticationService: MatrixAuthenticationService = FakeMatrixAuthenticationService() ): DefaultUnifiedPushNewGatewayHandler { return DefaultUnifiedPushNewGatewayHandler( pusherSubscriber = pusherSubscriber,