kotest-assertions / io.kotest.assertions.throwables / shouldNotThrowAnyUnit

shouldNotThrowAnyUnit

inline fun shouldNotThrowAnyUnit(block: () -> Unit): Unit

Verifies that a block of code does NOT throw any Throwable

Use function to wrap a block of code that you want to make sure doesn't throw any Throwable, where using shouldNotThrowAny can't be used for any reason, such as an assignment of a variable (assignments are statements, therefore has no return value).

Note that executing this code is no different to executing block itself, as any uncaught exception will be propagated up anyways.

See Also

shouldNotThrowAny

shouldNotThrowExactlyUnit

shouldNotThrowUnit