dev.forkhandles.result4k.strikt.matchers.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of result4k-strikt Show documentation
Show all versions of result4k-strikt Show documentation
ForkHandles Library Testing Helpers (Strikt)
The newest version!
package dev.forkhandles.result4k.strikt
import dev.forkhandles.result4k.Failure
import dev.forkhandles.result4k.Success
import strikt.api.Assertion
import strikt.assertions.isA
import strikt.assertions.isEqualTo
fun Assertion.Builder<*>.isSuccess() =
isA>()
fun Assertion.Builder<*>.isFailure() =
isA>()
@JvmName("isSuccessOfInstance")
inline fun Assertion.Builder<*>.isSuccess() =
isA>().and { get { value }.isA() }
@JvmName("isFailureOfInstance")
inline fun Assertion.Builder<*>.isFailure() =
isA>().and { get { reason }.isA() }
@JvmName("isSuccessOfInstanceAndValue")
inline fun Assertion.Builder<*>.isSuccess(expected: T) =
isA>().and { get { value }.isEqualTo(expected) }
@JvmName("isFailureOfInstanceAndValue")
inline fun Assertion.Builder<*>.isFailure(expected: E) =
isA>().and { get { reason }.isEqualTo(expected) }