All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.forkhandles.result4k.strikt.matchers.kt Maven / Gradle / Ivy

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) }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy