Class GeneralMatchers

java.lang.Object
org.testfx.matcher.base.GeneralMatchers

public class GeneralMatchers extends Object
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> org.hamcrest.Matcher<T>
    baseMatcher(String descriptionText, Predicate<T> predicate)
    Creates a matcher that matches when the given predicate returns true.
    static <S, T extends S>
    org.hamcrest.Matcher<S>
    typeSafeMatcher(Class<T> expectedType, String descriptionText, Function<S,String> describeActual, Predicate<T> predicate)
    Creates a matcher that matches when the passed-in object is not null, is an instance of the given type, and the given predicate returns true when that object is passed into it.
    static <S, T extends S>
    org.hamcrest.Matcher<S>
    typeSafeMatcher(Class<T> expectedType, String descriptionText, Predicate<T> predicate)
    Creates a matcher that matches when the passed-in object is not null, is an instance of the given type, and the given predicate returns true when that object is passed into it.

    Methods inherited from class java.lang.Object

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

    • GeneralMatchers

      private GeneralMatchers()
  • Method Details

    • baseMatcher

      public static <T> org.hamcrest.Matcher<T> baseMatcher(String descriptionText, Predicate<T> predicate)
      Creates a matcher that matches when the given predicate returns true.
      Parameters:
      descriptionText - describes what the matcher tries to match. This is used to explain what happened when a match fails.
      predicate - the predicate that the passed-in object must pass (i.e. predicate.apply(object) returns true) to match
    • typeSafeMatcher

      public static <S, T extends S> org.hamcrest.Matcher<S> typeSafeMatcher(Class<T> expectedType, String descriptionText, Predicate<T> predicate)
      Creates a matcher that matches when the passed-in object is not null, is an instance of the given type, and the given predicate returns true when that object is passed into it.
      Parameters:
      expectedType - the class that the passed-in object must be an instance of to match
      descriptionText - describes what the matcher tries to match. This is used to explain what happened when a match fails.
      predicate - the predicate that the passed-in object must pass (i.e. predicate.apply(object) returns true) to match
    • typeSafeMatcher

      public static <S, T extends S> org.hamcrest.Matcher<S> typeSafeMatcher(Class<T> expectedType, String descriptionText, Function<S,String> describeActual, Predicate<T> predicate)
      Creates a matcher that matches when the passed-in object is not null, is an instance of the given type, and the given predicate returns true when that object is passed into it.
      Parameters:
      expectedType - the class that the passed-in object must be an instance of to match
      descriptionText - describes what the matcher tries to match. This is used to explain what happened when a match fails.
      describeActual - a Function which takes as input the "actual" object and produces a String that clearly describes the "actual" object. This is used for producing a human-readable description of the difference between the "expected" and "actual" if the Matcher fails
      predicate - the predicate that the passed-in object must pass (i.e. predicate.apply(object) returns true) to match