Class TypeSafeMatching

    • Constructor Detail

      • TypeSafeMatching

        private TypeSafeMatching()
    • Method Detail

      • apply

        public boolean apply​(ArgumentMatcher matcher,
                             java.lang.Object argument)
        Description copied from interface: ArgumentMatcherAction
        Implementations must apply the given matcher to the argument and return 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. .
        Specified by:
        apply in interface ArgumentMatcherAction
        Parameters:
        matcher - to process the argument, never null
        argument - to be processed by the matcher, can be null
        Returns:
        • true if the matcher was successfully applied to the argument and the next pair of matcher and argument should be passed
        • false otherwise
      • isCompatible

        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.
      • isMatchesMethod

        private static boolean isMatchesMethod​(java.lang.reflect.Method method)
        Returns true if the given method is ArgumentMatcher.matches(Object)