doc / ch.tutteli.atrium.domain.builders.creating / AnyTypeTransformationFailureHandlerFactoryBuilder / newExplanatoryWithHint

newExplanatoryWithHint

inline fun <S : Any, T : Any> newExplanatoryWithHint(noinline showHint: () -> Boolean, noinline failureHintFactory: () -> Assertion): AnyTypeTransformation.FailureHandler<S, T>

Overrides FailureHandlerFactory.newExplanatoryWithHint

Creates a AnyTypeTransformation.FailureHandler which wraps subsequent assertions into an AssertionGroup with an ExplanatoryAssertionGroupType so that the user of Atrium can see in 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.