public class GeneralMatchers
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> org.hamcrest.Matcher<T> |
baseMatcher(java.lang.String descriptionText,
java.util.function.Predicate<T> predicate)
Creates a matcher that matches when the given
predicate returns true. |
static <S,T extends S> |
typeSafeMatcher(java.lang.Class<T> expectedType,
java.lang.String descriptionText,
java.util.function.Function<S,java.lang.String> describeActual,
java.util.function.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> |
typeSafeMatcher(java.lang.Class<T> expectedType,
java.lang.String descriptionText,
java.util.function.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. |
public static <T> org.hamcrest.Matcher<T> baseMatcher(java.lang.String descriptionText,
java.util.function.Predicate<T> predicate)
predicate returns true.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 matchpublic static <S,T extends S> org.hamcrest.Matcher<S> typeSafeMatcher(java.lang.Class<T> expectedType,
java.lang.String descriptionText,
java.util.function.Predicate<T> predicate)
predicate returns true when that object is passed into it.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 matchpublic static <S,T extends S> org.hamcrest.Matcher<S> typeSafeMatcher(java.lang.Class<T> expectedType,
java.lang.String descriptionText,
java.util.function.Function<S,java.lang.String> describeActual,
java.util.function.Predicate<T> predicate)
predicate returns true when that object is passed into it.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 - 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 failspredicate - the predicate that the passed-in object must pass (i.e. predicate.apply(object)
returns true) to match