doc / ch.tutteli.atrium.api.cc.infix.en_GB / toThrow

toThrow

inline infix fun <reified TExpected : Throwable> Builder.toThrow(noinline assertionCreator: Assert<TExpected>.() -> Unit): Unit (source)

Makes the assertion that the thrown Throwable is of type TExpected and it assertionCreator which are checked additionally as well.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
Notice, that this assertion function cannot provide a fluent API because it depends on whether the first assertion (a Throwable was thrown) holds or not. Define subsequent assertions via the assertionCreator lambda.