public class Matchers extends Object
Matchers class provides a factory for matchers.| Constructor and Description |
|---|
Matchers() |
| Modifier and Type | Method and Description |
|---|---|
static <T,S> org.hamcrest.Matcher<T> |
closeTo(java.util.function.Function<T,S> function,
String describer,
T operand,
double epsilon)
Applies a function to the matched object and the provided one in order to
retrieve values to check if they are the same with a tolerable error as
determined by calling the
Objects.deepEquals(java.lang.Object, java.lang.Object, double) method. |
static <T,S> org.hamcrest.Matcher<T> |
equalTo(java.util.function.Function<T,S> function,
String describer,
T operand)
Applies a function to the matched object and the provided one in order to
retrieve values to check if they are the same as determined by calling
the
Objects.deepEquals(java.lang.Object, java.lang.Object) method. |
static <T,S> org.hamcrest.Matcher<T> |
fieldEqualTo(String field,
org.hamcrest.Matcher<S> matcher)
Retrieves a field from the matched object and starts matching this new
object with the specified matcher.
|
static <E> org.hamcrest.Matcher<Optional<E>> |
hasValue(E value)
Creates a matcher for
Optionals matching examined optionals whose
value is equal to the provided one. |
static <E> org.hamcrest.Matcher<Optional<E>> |
hasValue(org.hamcrest.Matcher<? super E> matcher)
Creates a matcher for
Optionals matching examined optionals whose
value matches the provided matcher. |
static <E> org.hamcrest.Matcher<Optional<E>> |
isEmpty()
Creates a matcher for
Optionals matching examined optionals whose
value is not present. |
static <E> org.hamcrest.Matcher<Optional<E>> |
isPresent()
Creates a matcher for
Optionals matching examined optionals whose
value is present. |
static <T,S> org.hamcrest.Matcher<T> |
that(java.util.function.Function<T,S> function,
String describer,
org.hamcrest.Matcher<S> matcher)
Applies a function to the matched object in order to retrieve another
and starts matching this new object with the specified matcher.
|
public static <T,S> org.hamcrest.Matcher<T> that(java.util.function.Function<T,S> function, String describer, org.hamcrest.Matcher<S> matcher)
function - the function to apply to the object currently being matched
in order to retrieve anotherdescriber - a describer string for the functionmatcher - the matcher to use for the retrieved object from the functionpublic static <T,S> org.hamcrest.Matcher<T> equalTo(java.util.function.Function<T,S> function, String describer, T operand)
Objects.deepEquals(java.lang.Object, java.lang.Object) method.function - the function to apply to the object currently being matched
and to the specified operand in order to retrieve values to be compareddescriber - a describer string for the functionoperand - the object to retrieve a value using the specified function
to compare withpublic static <T,S> org.hamcrest.Matcher<T> closeTo(java.util.function.Function<T,S> function, String describer, T operand, double epsilon)
Objects.deepEquals(java.lang.Object, java.lang.Object, double) method.function - the function to apply to the object currently being matched
and to the specified operand in order to retrieve values to be compareddescriber - a describer string for the functionoperand - the object to retrieve a value using the specified function
to compare withepsilon - the tolerable errorpublic static <T,S> org.hamcrest.Matcher<T> fieldEqualTo(String field, org.hamcrest.Matcher<S> matcher)
field - the name of the field to retrieve from the object currently
being matchedmatcher - the matcher to use for the retrieved object from the fieldpublic static <E> org.hamcrest.Matcher<Optional<E>> isPresent()
Optionals matching examined optionals whose
value is present.E - the type of the valuepublic static <E> org.hamcrest.Matcher<Optional<E>> isEmpty()
Optionals matching examined optionals whose
value is not present.E - the type of the valuepublic static <E> org.hamcrest.Matcher<Optional<E>> hasValue(E value)
Optionals matching examined optionals whose
value is equal to the provided one.E - the type of the valuevalue - the object to compare the optional's value withpublic static <E> org.hamcrest.Matcher<Optional<E>> hasValue(org.hamcrest.Matcher<? super E> matcher)
Optionals matching examined optionals whose
value matches the provided matcher.E - the type of the valuematcher - a matcher for the optional's value to match againstCopyright (C) 2015-2017 The Helenus Driver Project Authors.