public class TypeSafeMatching extends java.lang.Object implements ArgumentMatcherAction
Modifier and Type | Field and Description |
---|---|
private static ArgumentMatcherAction |
TYPE_SAFE_MATCHING_ACTION |
Modifier | Constructor and Description |
---|---|
private |
TypeSafeMatching() |
Modifier and Type | Method and Description |
---|---|
boolean |
apply(ArgumentMatcher matcher,
java.lang.Object argument)
Implementations must apply the given matcher to the argument and return
true if the operation was successful or false
if not. |
private static java.lang.Class<?> |
getArgumentType(ArgumentMatcher<?> argumentMatcher)
Returns the type of
ArgumentMatcher.matches(Object) of the given
ArgumentMatcher implementation. |
private static boolean |
isCompatible(ArgumentMatcher<?> argumentMatcher,
java.lang.Object argument)
Returns
true if the given argument can be passed to
the given argumentMatcher without causing a
ClassCastException . |
private static boolean |
isMatchesMethod(java.lang.reflect.Method method)
Returns
true if the given method is
ArgumentMatcher.matches(Object) |
static ArgumentMatcherAction |
matchesTypeSafe() |
private static final ArgumentMatcherAction TYPE_SAFE_MATCHING_ACTION
public static ArgumentMatcherAction matchesTypeSafe()
public boolean apply(ArgumentMatcher matcher, java.lang.Object argument)
ArgumentMatcherAction
true
if the operation was successful or false
if not. In this case no more matchers and arguments will be passed by
MatcherApplicationStrategy.forEachMatcherAndArgument(ArgumentMatcherAction)
to this method.
.apply
in interface ArgumentMatcherAction
matcher
- to process the argument, never null
argument
- to be processed by the matcher, can be null
true
if the matcher was successfully
applied to the argument and the next pair of matcher and
argument should be passed
false
otherwise
private static boolean isCompatible(ArgumentMatcher<?> argumentMatcher, java.lang.Object argument)
true
if the given argument can be passed to
the given argumentMatcher
without causing a
ClassCastException
.private static java.lang.Class<?> getArgumentType(ArgumentMatcher<?> argumentMatcher)
ArgumentMatcher.matches(Object)
of the given
ArgumentMatcher
implementation.private static boolean isMatchesMethod(java.lang.reflect.Method method)
true
if the given method is
ArgumentMatcher.matches(Object)