Package org.mockito.internal.invocation
Class MatcherApplicationStrategy
java.lang.Object
org.mockito.internal.invocation.MatcherApplicationStrategy
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Invocationprivate final List<ArgumentMatcher<?>>private final MatcherApplicationStrategy.MatcherApplicationType -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMatcherApplicationStrategy(Invocation invocation, List<ArgumentMatcher<?>> matchers, MatcherApplicationStrategy.MatcherApplicationType matchingType) -
Method Summary
Modifier and TypeMethodDescriptionprivate static List<ArgumentMatcher<?>>appendLastMatcherNTimes(List<ArgumentMatcher<?>> matchers, int timesToAppendLastMatcher) booleanApplies the givenArgumentMatcherActionto all arguments and corresponding matchersstatic MatcherApplicationStrategygetMatcherApplicationStrategyFor(Invocation invocation, List<ArgumentMatcher<?>> matchers) Returns theMatcherApplicationStrategythat must be used to capture the arguments of the given invocation using the given matchers.private static MatcherApplicationStrategy.MatcherApplicationTypegetMatcherApplicationType(Invocation invocation, List<ArgumentMatcher<?>> matchers) private static booleanisLastMatcherVarargMatcher(List<ArgumentMatcher<?>> matchers) private static ArgumentMatcher<?>lastMatcher(List<ArgumentMatcher<?>> matchers) private static intvarargLength(Invocation invocation)
-
Field Details
-
invocation
-
matchers
-
matchingType
-
-
Constructor Details
-
MatcherApplicationStrategy
private MatcherApplicationStrategy(Invocation invocation, List<ArgumentMatcher<?>> matchers, MatcherApplicationStrategy.MatcherApplicationType matchingType)
-
-
Method Details
-
getMatcherApplicationStrategyFor
public static MatcherApplicationStrategy getMatcherApplicationStrategyFor(Invocation invocation, List<ArgumentMatcher<?>> matchers) Returns theMatcherApplicationStrategythat must be used to capture the arguments of the given invocation using the given matchers.- Parameters:
invocation- that contain the arguments to capturematchers- that will be used to capture the arguments of the invocation, the passedListis not required to contain aCapturingMatcher- Returns:
- never
null
-
forEachMatcherAndArgument
Applies the givenArgumentMatcherActionto all arguments and corresponding matchers- Parameters:
action- must not benull- Returns:
trueif the given action returnedtruefor all arguments and matchers passed to it.falseif the given action returnedfalsefor one of the passed arguments and matchersfalseif the given matchers don't fit to the given invocation because too many or to few matchers are available.
-
getMatcherApplicationType
private static MatcherApplicationStrategy.MatcherApplicationType getMatcherApplicationType(Invocation invocation, List<ArgumentMatcher<?>> matchers) -
isLastMatcherVarargMatcher
-
appendLastMatcherNTimes
private static List<ArgumentMatcher<?>> appendLastMatcherNTimes(List<ArgumentMatcher<?>> matchers, int timesToAppendLastMatcher) -
varargLength
-
lastMatcher
-