doc / ch.tutteli.atrium.domain.creating.collectors / AssertionCollector / collectNullableOrExplain

collectNullableOrExplain

open fun <T> collectNullableOrExplain(safeToCollect: Boolean, warningCannotEvaluate: Translatable, plant: AssertionPlantNullable<T>, assertionCreator: CollectingAssertionPlantNullable<T>.() -> Unit): AssertionGroup (source)

Depending on the given safeToCollect it either AssertionCollector.collects the assertions the given assertionCreator might create or it uses it to create an AssertionGroup with an ExplanatoryAssertionGroupType.

Parameters

safeToCollect - Indicates whether it is safe to use the AssertionPlantNullable.subjectProvider (means it does not throw a PlantHasNoSubjectException if called)

warningCannotEvaluate - The translatable used to explain why the assertions could not be evaluated.

plant - The plant from which the AssertionPlantNullable.subject will be used as subject of the CollectingAssertionPlantNullable.

assertionCreator - A lambda which typically creates a sub AssertionPlant and adds assertions to it. For instance, if you create a feature assertion or a type transformation assertion, you will typically end up creating a sub assertion plant which delegates created Assertions to the CollectingAssertionPlantNullable.

open fun <T> collectNullableOrExplain(safeToCollect: Boolean, warningCannotEvaluate: Translatable, subjectProvider: () -> T, assertionCreator: CollectingAssertionPlantNullable<T>.() -> Unit): AssertionGroup (source)

Depending on the given safeToCollect it either AssertionCollector.collects the assertions the given assertionCreator might create or it uses it to create an AssertionGroup with an ExplanatoryAssertionGroupType.

Parameters

safeToCollect - Indicates whether it is safe to use the subjectProvider (means it does not throw a PlantHasNoSubjectException if called)

warningCannotEvaluate - The translatable used to explain why the assertions could not be evaluated.

subjectProvider - Provides the subject which is used as CollectingAssertionPlantNullable.subject.

assertionCreator - A lambda which typically creates a sub AssertionPlant and adds assertions to it. For instance, if you create a feature assertion or a type transformation assertion, you will typically end up creating a sub assertion plant which delegates created Assertions to the CollectingAssertionPlantNullable.