doc / ch.tutteli.atrium.domain.builders.creating.changers / FeatureExtractorBuilder

FeatureExtractorBuilder

interface FeatureExtractorBuilder

Defines the contract for sophisticated safe feature extractions including assertion creation for the feature.

It is similar to NewFeatureAssertions but differs in the intended usage. NewFeatureAssertions are intended to make assertions about a return value of a method call or a property, assuming that the call as such always succeeds (no exception is thrown). The FeatureExtractorBuilder on the other hand should be used if it is already known, that the call/access fails depending on given arguments. For instance, List.get is a good example where it fails if the given index is out of bounds.

Types

DescriptionStep

interface DescriptionStep<T>

Step which allows to specify the description which will be used to describe the feature.

FeatureExtractionStep

interface FeatureExtractionStep<T>

Step to define the feature extraction as such where a one can include a check by returning None in case the extraction should not be carried out.

FinalStep

interface FinalStep<T, R>

Final step in the extract-feature-process, creates a ExtractedFeaturePostStep based on the previously specified options.

OptionsChooser

interface OptionsChooser<R>

Helper lambda to specify FeatureOptions via convenience methods.

OptionsStep

interface OptionsStep<T, R>

Step which allows to override previously defined properties -- such as use a different description -- but also allows to define options where usually a default value is used, such as use the subject itself as representation.

RepresentationInCaseOfFailureStep

interface RepresentationInCaseOfFailureStep<T>

Step which allows to to define the representation which shall be used in case the extraction cannot be performed.

Companion Object Functions

create

fun <T> create(originalAssertionContainer: Expect<T>): FeatureExtractorBuilder.DescriptionStep<T>

Entry point to use the FeatureExtractorBuilder.