Updated on 2026-08-14
This commit is contained in:
parent
3b65bef8a8
commit
75cdf4011c
5 changed files with 479 additions and 7 deletions
|
|
@ -1,6 +1,8 @@
|
|||
package com.tangem.common.test.utils
|
||||
|
||||
import arrow.core.Either
|
||||
import arrow.core.None
|
||||
import arrow.core.Option
|
||||
import com.google.common.truth.Truth
|
||||
|
||||
fun <B> assertEither(actual: Either<Throwable, B>, expected: Either<Throwable, B>) {
|
||||
|
|
@ -29,4 +31,16 @@ fun <B> assertEitherLeft(actual: Either<Throwable, B>, expected: Throwable) {
|
|||
Truth.assertThat(it::class.java).isEqualTo(expected::class.java)
|
||||
Truth.assertThat(it).hasMessageThat().isEqualTo(expected.message)
|
||||
}
|
||||
}
|
||||
|
||||
fun <B> assertNone(actual: Option<B>) {
|
||||
Truth.assertThat(actual).isEqualTo(None)
|
||||
}
|
||||
|
||||
fun <B> assertSome(actual: Option<B>, expected: B) {
|
||||
actual
|
||||
.onNone { error("Actual is None") }
|
||||
.onSome {
|
||||
Truth.assertThat(it).isEqualTo(expected)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue