doc / ch.tutteli.atrium / AtriumFactory / newCollectingPlant

newCollectingPlant

fun <T : Any> newCollectingPlant(subjectProvider: () -> T): ICollectingAssertionPlant<T>

Overrides IAtriumFactory.newCollectingPlant

Creates an ICollectingAssertionPlant which is intended to be used as receiver object in lambdas to collect created IAssertions inside the lambda.

Notice, that this IAssertionPlant might not even provide a IAssertionPlant.subject in which case it throws an PlantHasNoSubjectException if subject is accessed. Use newCheckingPlant instead if you want to know whether the assertions hold.

Parameters

subjectProvider - The function which will either provide the subject for this plant or throw an PlantHasNoSubjectException in case it cannot be provided.

Return
The newly created assertion plant.