Class InstanceOf

java.lang.Object
org.mockito.internal.matchers.InstanceOf
All Implemented Interfaces:
Serializable, ArgumentMatcher<Object>
Direct Known Subclasses:
InstanceOf.VarArgAware

public class InstanceOf extends Object implements ArgumentMatcher<Object>, Serializable
See Also:
  • Field Details

    • clazz

      private final Class<?> clazz
    • description

      private final String description
  • Constructor Details

    • InstanceOf

      public InstanceOf(Class<?> clazz)
    • InstanceOf

      public InstanceOf(Class<?> clazz, String describedAs)
  • Method Details

    • matches

      public boolean matches(Object actual)
      Description copied from interface: ArgumentMatcher
      Informs if this matcher accepts the given argument.

      The method should never assert if the argument doesn't match. It should only return false.

      See the example in the top level javadoc for ArgumentMatcher

      Specified by:
      matches in interface ArgumentMatcher<Object>
      Parameters:
      actual - the argument
      Returns:
      true if this matcher accepts the given argument.
    • toString

      public String toString()
      Overrides:
      toString in class Object