doc / ch.tutteli.atrium.api.fluent.en_GB.jdk8 / 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 if the given assertion is success

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
This assertion container to support a fluent API.

Since
0.9.0