| Modifier and Type | Field and Description |
|---|---|
static UniformMatcher<java.lang.Object> |
DEFAULT_MATCHER
Basic matcher, using
Object.equals(Object) method of first object. |
static UniformMatcher<java.lang.Object> |
REFERENCE_MATCHER
Matcher which is using reference equality, i.e. each object only matches with itself.
|
static UniformMatcher<java.lang.Object> |
REVERTED_DEFAULT_MATCHER
Basic matcher, using
Object.equals(Object) method of second object. |
| Modifier and Type | Method and Description |
|---|---|
static <T extends java.lang.Comparable<T>> |
forClass(java.lang.Class<T> type)
Create a matcher for a comparable type.
|
static <T> UniformMatcher<T> |
from(java.util.Comparator<T> comparator)
Create a matcher from a comparator.
|
static <T1,T2> Matcher<T1,T2> |
negate(Matcher<T1,T2> matcher)
Get a matcher which negates the result of a basic one.
|
static <T1,T2> Matcher<T1,T2> |
revert(Matcher<T2,T1> matcher)
Get a reverted matcher from a basic one.
|
static <T1,T2> Matcher<T1,T2> |
withNull(Matcher<T1,T2> matcher)
Get a matcher which enhances a given matcher which is not expecting
null values
with one which does. |
public static final UniformMatcher<java.lang.Object> DEFAULT_MATCHER
Object.equals(Object) method of first object.
The value null is allowed and handled.public static final UniformMatcher<java.lang.Object> REVERTED_DEFAULT_MATCHER
Object.equals(Object) method of second object.
The value null is allowed and handled.public static final UniformMatcher<java.lang.Object> REFERENCE_MATCHER
null is allowed and handled.public static <T1,T2> Matcher<T1,T2> revert(@NotNull Matcher<T2,T1> matcher)
The reverted matcher compares two objects in the different direction. Basically equality should not depend on the direction, but in real life things are more complicated.
T1 - type 1T2 - type 2matcher - basic matcherRevertedMatcherpublic static <T1,T2> Matcher<T1,T2> negate(@NotNull Matcher<T1,T2> matcher)
T1 - type 1T2 - type 2matcher - basic matchertrue when the basic matcher returns false
and vice versaNegateMatcherpublic static <T1,T2> Matcher<T1,T2> withNull(@NotNull Matcher<T1,T2> matcher)
null values
with one which does.T1 - type 1T2 - type 2matcher - basic matcher not handling null valuesnull valuespublic static <T> UniformMatcher<T> from(@NotNull java.util.Comparator<T> comparator)
0 result.T - typecomparator - comparatorComparatorMatcherpublic static <T extends java.lang.Comparable<T>> UniformMatcher<T> forClass(@NotNull java.lang.Class<T> type)
0 result.T - typetype - comparable typeComparableMatcher