Validate several ids in constructors (#336)

* Validate ids in constructors.

* Remove redundant `.value` usage in string interpolation.

* Make a distinction between `SessionId` and `UserId` in `TestData`.
This commit is contained in:
Jorge Martin Espinosa
2023-04-18 18:17:13 +02:00
committed by GitHub
parent 638b45930e
commit fae3417181
36 changed files with 193 additions and 199 deletions
@@ -16,18 +16,17 @@
package io.element.android.tests.testutils
import com.google.common.truth.Truth.assertThat
import org.junit.Assert.assertThrows
/**
* Assert that the lambda throws on debug and returns null on release.
* Assert that the lambda throws only on debug mode.
*/
fun assertNullOrThrow(lambda: () -> Any?) {
fun assertThrowsInDebug(lambda: () -> Any?) {
if (BuildConfig.DEBUG) {
assertThrows(IllegalStateException::class.java) {
lambda()
}
} else {
assertThat(lambda()).isNull()
lambda()
}
}