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

newReportingPlantAndAddAssertionsCreatedBy

open fun <T : Any> newReportingPlantAndAddAssertionsCreatedBy(assertionVerb: Translatable, subjectProvider: () -> T, reporter: Reporter, assertionCreator: AssertionPlant<T>.() -> Unit): AssertionPlant<T>
Deprecated: Switch to Expect instead of Assert, thus use newReportingAssertionContainer instead; will be removed with 1.0.0

Creates a ReportingAssertionPlant which AssertionPlant.addAssertionsCreatedBy the given assertionCreator lambda where the created Assertions are added as a group and usually (depending on the configured Reporter) reported as a whole.

It creates a CoreFactory.newThrowingAssertionChecker based on the given reporter for assertion checking, uses subjectProvider as AssertionPlantWithCommonFields.CommonFields.subjectProvider but also as AssertionPlantWithCommonFields.CommonFields.representationProvider. Notice that evalOnce is applied to the given subjectProvider to avoid side effects (the provider is most likely called more than once).

Parameters

assertionVerb - The assertion verb which will be used inter alia in reporting (see AssertionPlantWithCommonFields.CommonFields.assertionVerb).

subjectProvider - Used as AssertionPlantWithCommonFields.CommonFields.subjectProvider but also as AssertionPlantWithCommonFields.CommonFields.representationProvider.

reporter - The reporter which will be used for a newThrowingAssertionChecker.

assertionCreator - The

Exceptions

AssertionError - The newly created AssertionPlant might throw an AssertionError in case a created Assertion does not hold.

Return
The newly created AssertionPlant which can be used to postulate further assertions.