doc / ch.tutteli.atrium.creating / ThrowableFluent

ThrowableFluent

class ThrowableFluent (source)

Provides toThrow methods for making assertions about a Throwable which one expects was thrown.

Properties

commonFields val commonFields: CommonFields<Throwable?>

The commonFields's subject represents the thrown Throwable and will be used in ThrowableFluent.toThrow. Its method IAssertionPlantWithCommonFields.CommonFields.fail could be used for failure reporting etc.

Functions

toThrow fun <TExpected : Throwable> toThrow(): IAssertionPlant<TExpected>

Makes an assertion about the commonFields's subject that it is of the expected type TExpected and reports an error if subject is null or another type than the expected one.

fun <TExpected : Throwable> toThrow(expectedType: KClass<TExpected>): IAssertionPlant<TExpected>
fun <TExpected : Throwable> toThrow(expectedType: KClass<TExpected>, createAssertions: IAssertionPlant<TExpected>.() -> Unit): IAssertionPlant<TExpected>

Use the overload with reified type parameter whenever possible.

fun <TExpected : Throwable> toThrow(createAssertions: IAssertionPlant<TExpected>.() -> Unit): IAssertionPlant<TExpected>

Makes an assertion about the commonFields's subject that it is of the expected type TExpected and reports an error if subject is null or another type than the expected one -- furthermore it createAssertions which are checked additionally as well.