doc / ch.tutteli.atrium.domain.creating.feature.extract / FeatureExtractor / CreatorLike / extractAndAssertIt

extractAndAssertIt

abstract fun extractAndAssertIt(assertionCreator: C.() -> Unit): Assertion

Extracts a feature with the help of the specified parameterObject.featureExtraction if it parameterObject.canBeExtracted and uses the given assertionCreator to create feature assertions.

In detail, it creates an AssertionGroup of type FeatureAssertionGroupType and either uses the given assertionCreator to create assertions about the feature if parameterObject.canBeExtracted evaluates to true or assertionCreator is used to create explanatory assertions (in case parameterObject.canBeExtracted evaluates to false).

Notice, if PlantHasNoSubjectException is thrown during the evaluation of parameterObject.canBeExtracted, then it is assumed reporting is taken place and it is already in the process of collecting assertions for explanation. In such a case assertionCreator is used to create assertions (not explanatory assertions within explanatory assertions).

Parameters

assertionCreator - A lambda which creates the Assertions for the extracted feature.

Returns
The assertion representing the feature extraction.