Package org.dmfs.jems2.mocks
Class MockFunction<Argument,Value>
java.lang.Object
org.dmfs.jems2.mocks.MockFunction<Argument,Value>
- All Implemented Interfaces:
org.dmfs.jems2.FragileFunction<Argument,,Value, RuntimeException> org.dmfs.jems2.Function<Argument,,Value> org.dmfs.jems2.ThrowingFunction<Argument,Value>
public final class MockFunction<Argument,Value>
extends Object
implements org.dmfs.jems2.Function<Argument,Value>
Mock
Function that can be used in tests as a convenience instead of 'manually' set up expectations for (multiple) calls.
It can be set up with Argument-Value Pairs so that when it is called it returns the Value from the Pair of the matching Argument.
For invocations with arguments that don't match any of the provided ones, it throws AssertionError.
-
Constructor Summary
ConstructorsConstructorDescriptionMockFunction(Argument argument, Value value) MockFunction(Iterable<org.dmfs.jems2.Pair<org.hamcrest.Matcher<Argument>, Value>> pairs) MockFunction(Iterable<org.hamcrest.Matcher<Argument>> args, Iterable<Value> values) MockFunction(org.dmfs.jems2.Pair<org.hamcrest.Matcher<Argument>, Value>... pairs) MockFunction(org.hamcrest.Matcher<Argument> argumentMatcher, Value value) -
Method Summary
-
Constructor Details
-
MockFunction
-
MockFunction
@SafeVarargs public MockFunction(org.dmfs.jems2.Pair<org.hamcrest.Matcher<Argument>, Value>... pairs) -
MockFunction
-
MockFunction
-
MockFunction
-
-
Method Details