doc / ch.tutteli.atrium.assertions.any.narrow.failurehandler / ExplanatoryDownCastFailureHandler / createAndAddAssertionToPlant

createAndAddAssertionToPlant

fun createAndAddAssertionToPlant(subType: KClass<TSub>, subjectPlant: IBaseAssertionPlant<T?, *>, failingAssertion: IAssertion, assertionCreator: IAssertionPlant<TSub>.() -> Unit): Unit

Wraps the assertions which might be created by assertionCreator into an ExplanatoryAssertionGroup and adds it to the given subjectPlant.

Parameters

subType - The type to which the subjectPlant's subject should have been down-casted. subjectPlant - The plant to which additional assertions would have been added. assertionCreator - The lambda which could have created subsequent assertions for the down-casted IAssertionPlant.subject.

Exceptions

AssertionError - Might throw an AssertionError depending on the subjectPlant.