doc / ch.tutteli.atrium.core / CoreFactoryCommon / newCollectingPlantNullable

newCollectingPlantNullable

abstract fun <T> newCollectingPlantNullable(subjectProvider: () -> T): CollectingAssertionPlantNullable<T> (source)

Creates a CollectingAssertionPlantNullable which is intended to be used as receiver object in lambdas to collect created Assertions inside the lambda.

Notice, that the plant might not provide a CollectingAssertionPlantNullable.subject in which case it throws a PlantHasNoSubjectException if subject is accessed.

Parameters

subjectProvider - The function which will either provide the subject for this plant or throw an PlantHasNoSubjectException in case it cannot provide it. A CollectingAssertionPlant should evaluate the subjectProvider only once.

Return
The newly created assertion plant.