Module org.easymock

Class InstanceOf

java.lang.Object
org.easymock.internal.matchers.InstanceOf
All Implemented Interfaces:
Serializable, IArgumentMatcher

public class InstanceOf extends Object implements IArgumentMatcher, Serializable
Matches if the argument is an instance of the given class.
Author:
OFFIS, Tammo Freese
See Also:
  • Constructor Details

    • InstanceOf

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

    • matches

      public boolean matches(Object actual)
      Description copied from interface: IArgumentMatcher
      Returns whether this matcher accepts the given argument.

      Like Object.equals(), it should be aware that the argument passed might be null and of any type. So you will usually start the method with an instanceof and/or null check.

      The method should never assert if the argument doesn't match. It should only return false. EasyMock will take care of asserting if the call is really unexpected.

      Specified by:
      matches in interface IArgumentMatcher
      Parameters:
      actual - the argument
      Returns:
      whether this matcher accepts the given argument.
    • appendTo

      public void appendTo(StringBuffer buffer)
      Description copied from interface: IArgumentMatcher
      Appends a string representation of this matcher to the given buffer. In case of failure, the printed message will show this string to allow to know which matcher was used for the failing call.
      Specified by:
      appendTo in interface IArgumentMatcher
      Parameters:
      buffer - the buffer to which the string representation is appended.