abstract fun <E : Any> collect(warning: Translatable, assertionCreator: AssertionPlant<E>.() -> Unit, subject: E?): List<Assertion>
(source)
Collects the Assertion created by assertionCreator and uses the given subject as CollectingAssertionPlant.subject if not null.
In contrast to regular AssertionCollector a
In case subject is null and assertionCreator tries to access it, then a PlantHasNoSubjectException is thrown and caught in which case a single AssertionGroup with an ExplanatoryAssertionGroupType is returned containing the given warning.
In contrast to ThrowingAssertionCollectorForExplanation this assertion collector does not throw.
warning
- The translatable used to explain why the assertions could not be evaluated.
assertionCreator
- The function which should at least create one assertion.
subject
- The subject which will be used for the AssertionPlant.
Return
A list with the collected assertion or an AssertionGroup with an ExplanatoryAssertionGroupType
containing a warning if subject is null
and an assertion function tries to access it.