fail

fun fail(message: String? = null): Nothing(source)

Marks a test as having failed if this point in the execution path is reached, with an optional message.

Since Kotlin

1.0

fun fail(message: String? = null, cause: Throwable? = null): Nothing(source)

Marks a test as having failed if this point in the execution path is reached, with an optional message and cause exception.

The cause exception is set as the root cause of the test failure.

Since Kotlin

1.4