doc / ch.tutteli.atrium.assertions.any.narrow / AnyNarrow / DownCastFailureHandler

DownCastFailureHandler

interface DownCastFailureHandler<T : Any, TSub : T>

A handler which decides how the lambda -- which could have created subsequent assertions for the down-casted AssertionPlant.subject if the down-cast of the AssertionPlant.subject to type TSub did not fail -- should be used in reporting.

Parameters

T - The type of AssertionPlant.subject. TSub - The type to which AssertionPlant.subject should have been be down-casted, hence needs to be a subtype of T.

Functions

createAndAddAssertionToPlant

abstract fun createAndAddAssertionToPlant(subType: KClass<TSub>, subjectPlant: BaseAssertionPlant<T?, *>, failingAssertion: Assertion, assertionCreator: AssertionPlant<TSub>.() -> Unit): Unit

Makes something with the given assertionCreator lambda; might add assertions to subjectPlant.

Inheritors

ExplanatoryDownCastFailureHandler

class ExplanatoryDownCastFailureHandler<T : Any, TSub : T> : DownCastFailureHandler<T, TSub>

Represents an AnyNarrow.DownCastFailureHandler which wraps subsequent assertions into an ExplanatoryAssertionGroup.