Class MapsArgument<In,DelegateIn,Out>
- java.lang.Object
-
- org.saynotobugs.confidence.quality.function.MapsArgument<In,DelegateIn,Out>
-
- All Implemented Interfaces:
Quality<java.util.function.Function<java.util.function.Function<DelegateIn,Out>,java.util.function.Function<In,Out>>>
public final class MapsArgument<In,DelegateIn,Out> extends java.lang.Object implements Quality<java.util.function.Function<java.util.function.Function<DelegateIn,Out>,java.util.function.Function<In,Out>>>
This quality can be used to isolate the logic of the outer function in a delegating function, which enables testing only the actual functions logic, not the logic of the delegate function.OuterFunction +-----------------------------------------------------------------------------------+ | DelegateFunction | | +------------------------------------------+ | | OuterArgument ----> | DelegateArgument -----> DelegateResult | ---> OuterResult | | +------------------------------------------+ | +-----------------------------------------------------------------------------------+
Example:assertThat(delegate -> x -> delegate.apply(x + 2), new MapsArgument<Integer, Integer, Integer>(1, equalTo(3)) );
-
-
Constructor Summary
Constructors Constructor Description MapsArgument(In outerArgument, Quality<? super DelegateIn> delegateArgumentQuality)Creates a new instance withouterArgumentas the input to the outer function and thedelegateArgumentQualityas quality matching the delegate argument.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AssessmentassessmentOf(java.util.function.Function<java.util.function.Function<DelegateIn,Out>,java.util.function.Function<In,Out>> candidate)Descriptiondescription()
-
-
-
Constructor Detail
-
MapsArgument
public MapsArgument(In outerArgument, Quality<? super DelegateIn> delegateArgumentQuality)
Creates a new instance withouterArgumentas the input to the outer function and thedelegateArgumentQualityas quality matching the delegate argument.
-
-
Method Detail
-
assessmentOf
public Assessment assessmentOf(java.util.function.Function<java.util.function.Function<DelegateIn,Out>,java.util.function.Function<In,Out>> candidate)
- Specified by:
assessmentOfin interfaceQuality<In>
-
description
public Description description()
- Specified by:
descriptionin interfaceQuality<In>
-
-