application.Outcome.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of specmatic-executable Show documentation
Show all versions of specmatic-executable Show documentation
Command-line standalone executable jar for Specmatic
package application
data class Outcome(val result: ResultType?, val errorMessage: String = "") {
fun onSuccess(fn: (ResultType) -> Outcome): Outcome {
return when {
result != null -> fn(result)
else -> Outcome(null, errorMessage)
}
}
fun handleSuccess(fn: (ResultType) -> Unit) {
when {
result != null -> fn(result)
else -> Outcome(null, errorMessage)
}
}
fun onFailure(fn: (String) -> Unit) {
if(result == null)
fn(errorMessage)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy