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

toThrow

inline fun <reified TExpected : Throwable> ThrowableThrown.Builder.toThrow(): Unit
Deprecated: Use pendant from package en_GB; will be removed with 1.0.0

Makes the assertion that the thrown Throwable is of type TExpected.

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 assertion (a Throwable was thrown and is of type TExpected) holds or not. If you want to define subsequent assertions on the down-casted Throwable, then use the overload which expects a lambda (where you can define subsequent assertions).

inline infix fun <reified TExpected : Throwable> ThrowableThrown.Builder.toThrow(noinline assertionCreator: Assert<TExpected>.() -> Unit): Unit
Deprecated: Use pendant from package en_GB; will be removed with 1.0.0

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.