fun downCast(description: Translatable, subType: KClass<TSub>, subjectPlant: BaseAssertionPlant<T?, *>, assertionCreator: AssertionPlant<TSub>.() -> Unit): Unit
(source)Performs the down-cast and applies the given assertionCreator to the down-casted subject of subjectPlant if successful or passes it to a AnyTypeTransformation.TypeTransformationFailureHandler otherwise.
It also adds a DescriptiveAssertion, representing the down-cast as such (succeeding or failing), to the given subjectPlant using the given description.
description
- The description of the resulting DescriptiveAssertion.
subType
- The type to which the subjectPlant's subject should be down-casted.
subjectPlant
- The plant to which additional assertions will be added.
assertionCreator
- The lambda function which can create subsequent assertions for the down-casted subject.
AssertionError
- Might throw an AssertionError in case the down-cast cannot be performed, depending on
the subjectPlant and the defined AnyTypeTransformation.TypeTransformationFailureHandler.