doc / ch.tutteli.atrium.domain.creating.any.typetransformation.failurehandlers / FailureHandlerFactory / newExplanatoryWithHint

newExplanatoryWithHint

abstract fun <S : Any, T : Any> newExplanatoryWithHint(showHint: () -> Boolean, failureHintFactory: () -> Assertion): FailureHandler<S, T> (source)

Creates a AnyTypeTransformation.FailureHandler which wraps subsequent assertions into an AssertionGroup with an ExplanatoryAssertionGroupType so that the user of Atrium can see in error reporting what one wanted to assert additionally -- moreover it includes a hint about the subject which shall only be shown if showHint evaluates to true in which case the given failureHintFactory should be used to create the hint.

As an example, Atrium uses this failure handler internally to show the message of a thrown Throwable in case it is of a different type than the expected one.

Parameters

showHint - Indicates whether the failure hint shall be included or not

failureHintFactory - Creates the failure hint.