Class PredicateMatcher<T>

java.lang.Object
org.hamcrest.BaseMatcher<T>
io.github.cjstehno.testthings.match.PredicateMatcher<T>
Type Parameters:
T - the matched type
All Implemented Interfaces:
org.hamcrest.Matcher<T>, org.hamcrest.SelfDescribing

public class PredicateMatcher<T> extends org.hamcrest.BaseMatcher<T>
A Hamcrest matcher used to wrap a Predicate where the matcher will match if the predicate resolves to true.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    describeTo(org.hamcrest.Description description)
     
    boolean
    matches(Object actual)
     
    static <T> org.hamcrest.Matcher<T>
    Creates the predicate matcher with a default description ("a supplied predicate").
    static <T> org.hamcrest.Matcher<T>
    matchesPredicate(Predicate<T> predicate, String descr)
    Creates the predicate matcher with the provided description.

    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

    • PredicateMatcher

      public PredicateMatcher()
  • Method Details

    • matchesPredicate

      public static <T> org.hamcrest.Matcher<T> matchesPredicate(Predicate<T> predicate)
      Creates the predicate matcher with a default description ("a supplied predicate").
      Type Parameters:
      T - the matched type
      Parameters:
      predicate - the predicate
      Returns:
      the matcher
    • matchesPredicate

      public static <T> org.hamcrest.Matcher<T> matchesPredicate(Predicate<T> predicate, String descr)
      Creates the predicate matcher with the provided description.
      Type Parameters:
      T - the matched type
      Parameters:
      predicate - the predicate
      descr - the description
      Returns:
      the matcher
    • matches

      public boolean matches(Object actual)
    • describeTo

      public void describeTo(org.hamcrest.Description description)