Skip to content

Commit

Permalink
Add contract for fail
Browse files Browse the repository at this point in the history
Created another fail method with a non-nullable lambda parameter

Issue: junit-team#1866
  • Loading branch information
awelless committed Aug 10, 2023
1 parent 1d5811b commit 19922d6
Showing 1 changed file with 12 additions and 0 deletions.
Expand Up @@ -29,6 +29,18 @@ import kotlin.contracts.contract
fun fail(message: String?, throwable: Throwable? = null): Nothing =
Assertions.fail<Nothing>(message, throwable)

/**
* @see Assertions.fail
*/
@JvmName("fail_nonNullableLambda")
fun fail(message: () -> String): Nothing {
contract {
callsInPlace(message)
}

return Assertions.fail<Nothing>(message)
}

/**
* @see Assertions.fail
*/
Expand Down

0 comments on commit 19922d6

Please sign in to comment.