Rename class (code quality)

This commit is contained in:
Benoit Marty 2024-05-23 14:42:00 +02:00
parent 6f44ef7a8f
commit 7911fda1fa
13 changed files with 61 additions and 61 deletions

View file

@ -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)

View file

@ -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()

View file

@ -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,

View file

@ -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(

View file

@ -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(

View file

@ -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(

View file

@ -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(

View file

@ -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,