doc / ch.tutteli.atrium.logic.creating.transformers / FailureHandlerAdapter

FailureHandlerAdapter

class FailureHandlerAdapter<T, R1, R> : SubjectChanger.FailureHandler<T, R> (source)

Represents a SubjectChanger.FailureHandler which acts as an adapter for another failure handler by mapping first the given subject to another type R1 which is understood as input of the other failure handler.

Effectively turning a FailureHandler<R1, R> into a FailureHandler<T, R> with the help of a mapping function (T) -> R1

Parameters

T - The type of the subject

R1 - The type of the mapped subject

R - The type of the subject after the subject change (if it were possible).

Constructors

<init>

FailureHandlerAdapter(failureHandler: SubjectChanger.FailureHandler<R1, R>, map: (T) -> R1)

Represents a SubjectChanger.FailureHandler which acts as an adapter for another failure handler by mapping first the given subject to another type R1 which is understood as input of the other failure handler.

Properties

failureHandler

val failureHandler: SubjectChanger.FailureHandler<R1, R>

map

val map: (T) -> R1

Functions

createAssertion

fun createAssertion(container: AssertionContainer<T>, descriptiveAssertion: Assertion, maybeAssertionCreator: Option<Expect<R>.() -> Unit>): Assertion

Creates the failing assertion most likely based on the given descriptiveAssertion -- which in turn is based on the previously specified description, representation etc. -- and should incorporate the assertions maybeAssertionCreator would have created for the new subject as explanatory assertions.