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
Deprecated: Switch from Assert to Expect; will be removed with 1.0.0 -- see https://github.com/robstoll/atrium/releases/tag/v0.12.0#migration for migration hints and scripts.

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.