Class Equals

java.lang.Object
org.hamcrest.BaseMatcher<T>
org.mockito.ArgumentMatcher<Object>
org.mockito.internal.matchers.Equals
All Implemented Interfaces:
Serializable, org.hamcrest.Matcher<Object>, org.hamcrest.SelfDescribing, ContainsExtraTypeInformation
Direct Known Subclasses:
ArrayEquals

public class Equals extends ArgumentMatcher<Object> implements ContainsExtraTypeInformation, Serializable
See Also:
  • Constructor Details

    • Equals

      public Equals(Object wanted)
  • Method Details

    • matches

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

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

      Specified by:
      matches in interface org.hamcrest.Matcher<Object>
      Specified by:
      matches in class ArgumentMatcher<Object>
      Parameters:
      actual - the argument
      Returns:
      whether this matcher accepts the given argument.
    • describeTo

      public void describeTo(org.hamcrest.Description description)
      Description copied from class: ArgumentMatcher
      By default this method decamelizes matchers name to promote meaningful names for matchers.

      For example StringWithStrongLanguage matcher will generate 'String with strong language' description in case of failure.

      You might want to override this method to provide more specific description of the matcher (useful when verification failures are reported).

      Specified by:
      describeTo in interface org.hamcrest.SelfDescribing
      Overrides:
      describeTo in class ArgumentMatcher<Object>
      Parameters:
      description - the description to which the matcher description is appended.
    • describe

      public String describe(Object object)
    • getWanted

      protected final Object getWanted()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • withExtraTypeInfo

      public org.hamcrest.SelfDescribing withExtraTypeInfo()
      Specified by:
      withExtraTypeInfo in interface ContainsExtraTypeInformation
    • typeMatches

      public boolean typeMatches(Object object)
      Specified by:
      typeMatches in interface ContainsExtraTypeInformation