doc / ch.tutteli.atrium.api.fluent.en_GB / cause

cause

inline fun <reified TExpected : Throwable> Expect<out Throwable>.cause(): Expect<TExpected>

Expects that the property Throwable.cause of the subject is a TExpected (the same type or a sub-type), creates an Expect of the TExpected type for it and returns it.

Exceptions

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

Return
The newly created Expect for the property Throwable.cause of the subject of the assertion.

Since
0.10.0

inline fun <reified TExpected : Throwable> Expect<out Throwable>.cause(noinline assertionCreator: Expect<TExpected>.() -> Unit): Expect<TExpected>

Expects that the property Throwable.cause of the subject is a TExpected (the same type or a sub-type) and holds all assertions the given assertionCreator creates for it and returns this assertion container.

Notice, in contrast to other assertion functions which expect an assertionCreator, this function returns not Expect of the initial type, which was some type T , but an Expect of the specified type TExpected.

Exceptions

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

Return
An Expect for the current subject of the assertion.

Since
0.10.0