doc / ch.tutteli.atrium.logic / collectBasedOnSubject

collectBasedOnSubject

inline fun <T> AssertionContainer<*>.collectBasedOnSubject(maybeSubject: Option<T>, noinline assertionCreator: Expect<T>.() -> Unit): Assertion (source)

Use this function if you want to make Assertions about a feature or you perform a type transformation or any other action which results in an Expect being created for a different subject and you do not require this resulting Expect.

Or in other words, you do not want to make further assertions about the resulting subject in the resulting sub Expect.

Note that an assertion will be added which fails in case assertionCreator does not create a single assertion.

Parameters

maybeSubject - Either Some wrapping the subject of the current assertion or None in case a previous subject transformation was not successful - this will be used as subject for the given assertionCreator.

assertionCreator - A lambda which defines the expectations for the given maybeSubject.

Return
The collected assertions.