Class And

java.lang.Object
org.hamcrest.BaseMatcher
org.mockito.ArgumentMatcher
org.mockito.internal.matchers.And
All Implemented Interfaces:
Serializable, org.hamcrest.Matcher, org.hamcrest.SelfDescribing

public class And extends ArgumentMatcher implements Serializable
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    And(List<org.hamcrest.Matcher> matchers)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    describeTo(org.hamcrest.Description description)
    By default this method decamelizes matchers name to promote meaningful names for matchers.
    boolean
    matches(Object actual)
    Returns whether this matcher accepts the given argument.

    Methods inherited from class org.hamcrest.BaseMatcher

    _dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, isNotNull, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • And

      public And(List<org.hamcrest.Matcher> matchers)
  • 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
      Specified by:
      matches in class ArgumentMatcher
      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
      Parameters:
      description - the description to which the matcher description is appended.