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

isPresent

fun <E, T : Optional<E>> Expect<T>.isPresent(): Expect<E>

Expects that the subject of the assertion (an Optional) is present and returns an Expect for the inner type E.

Shortcut for more or less something like feature(Optional<T>::get) but with error handling; yet it depends on the underlying implementation though.

Exceptions

AssertionError - Might throw an AssertionError if the given assertion is not a success.

Return
The newly created Expect for the inner type E.

Since
0.9.0

fun <E, T : Optional<E>> Expect<T>.isPresent(assertionCreator: Expect<E>.() -> Unit): Expect<T>

Expects that the subject of the assertion (an Optional) is present and that it holds all assertions the given assertionCreator creates.

Exceptions

AssertionError - Might throw an AssertionError if the given assertions are not success.

Return
An Expect for the current subject of the assertion.

Since
0.9.0