Introduce lambdaError instead of using TODO, to handle error when a lambda is invoked and it should not.

This commit is contained in:
Benoit Marty 2024-05-23 09:12:40 +02:00
parent 955b4308ce
commit 4fc3c6f889
21 changed files with 77 additions and 33 deletions

View file

@ -24,4 +24,5 @@ android {
dependencies {
implementation(projects.libraries.matrix.api)
implementation(projects.libraries.pushproviders.api)
implementation(projects.tests.testutils)
}

View file

@ -27,8 +27,8 @@ class FakePushProvider(
private val isAvailable: Boolean = true,
private val distributors: List<Distributor> = listOf(Distributor("aDistributorValue", "aDistributorName")),
private val currentUserPushConfig: CurrentUserPushConfig? = null,
private val registerWithResult: (MatrixClient, Distributor) -> Result<Unit> = { _, _ -> TODO() },
private val unregisterWithResult: (MatrixClient) -> Result<Unit> = { TODO() },
private val registerWithResult: (MatrixClient, Distributor) -> Result<Unit> = { _, _ -> lambdaError() },
private val unregisterWithResult: (MatrixClient) -> Result<Unit> = { lambdaError() },
) : PushProvider {
override fun isAvailable(): Boolean = isAvailable