Esito test utilities.
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
testImplementation("com.github.Subito-it.Esito:test:(insert latest version)")
}
Esito is providing two extension methods to facilitate testing: assertIsSuccess
and assertIsFailure
, here is an example of usage:
val success = Result.success<Int, Throwable>(42)
success.assertIsSuccess {
assertEquals(42, value)
}
val failure = Result.failure<Int, RuntimeException>(RuntimeException("Ops"))
failure.assertIsFailure {
assertEquals("Ops", error.message)
}