doc / ch.tutteli.atrium.logic / collect

collect

inline fun <T> AssertionContainer<T>.collect(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.

It uses the AssertionContainer.maybeSubject as subject of the given assertionCreator and delegates to collectBasedOnSubject.

Parameters

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

Return
The collected assertions.