doc / ch.tutteli.atrium.logic.creating.transformers / SubjectChangerBuilder / FailureHandlerStep

FailureHandlerStep

interface FailureHandlerStep<T, R> (source)

Optional step which allows to specify a custom SubjectChanger.FailureHandler.

Parameters

T - the type of the current subject.

R - the type of the new subject.

Properties

transformation

abstract val transformation: (T) -> Option<R>

The previously specified transformation which will yield the new subject.

transformationStep

abstract val transformationStep: SubjectChangerBuilder.TransformationStep<T>

The so far chosen options up to the TransformationStep step.

Functions

build

open fun build(): SubjectChangerBuilder.ExecutionStep<T, R>

Skips this step by using withDefaultFailureHandler and calls FinalStep.build.

withDefaultFailureHandler

abstract fun withDefaultFailureHandler(): SubjectChangerBuilder.FinalStep<T, R>

Uses the default SubjectChanger.FailureHandler which builds the failing assertion based on the specified TransformationStep.description and TransformationStep.representation and includes the assertions a given assertionCreator lambda would create.

withFailureHandler

abstract fun withFailureHandler(failureHandler: SubjectChanger.FailureHandler<T, R>): SubjectChangerBuilder.FinalStep<T, R>

Uses the given failureHandler as SubjectChanger.FailureHandler to create the failing assertion in case the subject change fails.

withFailureHandlerAdapter

open fun <R1> withFailureHandlerAdapter(failureHandler: SubjectChanger.FailureHandler<R1, R>, map: (T) -> R1): SubjectChangerBuilder.FinalStep<T, R>

Uses the given failureHandler as SubjectChanger.FailureHandler to create the failing assertion in case the subject change fails but previously maps the subject from T to R1 as the failure handler only deals with R1 subjects.

Companion Object Functions

invoke

operator fun <T, R> invoke(transformationStep: SubjectChangerBuilder.TransformationStep<T>, transformation: (T) -> Option<R>): SubjectChangerBuilder.FailureHandlerStep<T, R>

Creates a FailureHandlerStep in the context of the SubjectChangerBuilder.

Inheritors

FailureHandlerStepImpl

class FailureHandlerStepImpl<T, R> : SubjectChangerBuilder.FailureHandlerStep<T, R>