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

toThrow

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

Makes the assertion that the thrown Throwable is of type TExpected and holds all assertions the assertionCreator might create in addition.

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.