Package org.testfx.matcher.base
Class GeneralMatchers
java.lang.Object
org.testfx.matcher.base.GeneralMatchers
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> org.hamcrest.Matcher
<T> baseMatcher
(String descriptionText, Predicate<T> predicate) Creates a matcher that matches when the givenpredicate
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 givenpredicate
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 givenpredicate
returns true when that object is passed into it.
-
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 givenpredicate
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 givenpredicate
returns true when that object is passed into it.- Parameters:
expectedType
- the class that the passed-in object must be an instance of to matchdescriptionText
- 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 givenpredicate
returns true when that object is passed into it.- Parameters:
expectedType
- the class that the passed-in object must be an instance of to matchdescriptionText
- describes what the matcher tries to match. This is used to explain what happened when a match fails.describeActual
- aFunction
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 theMatcher
failspredicate
- the predicate that the passed-in object must pass (i.e. predicate.apply(object) returns true) to match
-