Suite • opensavvy.prepared.suite.assertions • checkThrows
checkThrows¶
inline fun <T : Throwable> checkThrows(block: () -> Any?): T
Verifies that block throws an exception of type T.
If block indeed throws an exception of type T, it is returned. In all other cases, an AssertionError is thrown.
Example¶
If the expected exception is thrown, it is returned by the function, so you can write further assertions. For example, if you want an exception with a specific message, write: