public final class UberMatchers
extends java.lang.Object
NumberMatchers| Modifier and Type | Method and Description |
|---|---|
static <T> org.hamcrest.Matcher<T> |
consistentWith(T value,
org.hamcrest.Matcher<? super T> matcher)
Create a matcher that will check that tested item and specified value are either both consistently matched,
or both consistently not matched by the specified matcher.
|
static <T,V> org.hamcrest.Matcher<V> |
convert(org.hamcrest.Matcher<T> m,
java.util.function.Function<V,T> f)
Create a matcher that will apply specified function to the received value and then delegate result
to the specified matcher delegate.
|
static <T> org.hamcrest.Matcher<T> |
deeplyEqualTo(T item)
Create a matcher that will check that tested item and specified value are equal
according to the
ComparisonPerformers.DEEP_EQUALS performer. |
static <T> org.hamcrest.Matcher<T> |
equalTo(T item,
ComparisonPerformer<? super T> performer)
Create a matcher that will check that tested item and specified value are equal
according to the specified
ComparisonPerformer. |
static <T> org.hamcrest.Matcher<java.util.Collection<? extends T>> |
hasAnyItem(java.util.Collection<T> items)
Equal to
hasAnyItem(Collection, BiPredicate) with Objects.deepEquals(Object, Object)
used as a predicate. |
static <T> org.hamcrest.Matcher<java.util.Collection<? extends T>> |
hasAnyItem(java.util.Collection<T> items,
java.util.function.BiPredicate<T,T> matcher)
Create a matcher that will check that a collection contains any one of the specified item.
|
static <T> org.hamcrest.Matcher<java.util.Collection<? extends T>> |
hasItem(T item,
java.util.function.BiPredicate<T,T> matcher)
Create a matcher that will check that a collection contains the specified item.
|
static <T> org.hamcrest.Matcher<T> |
isIn(java.util.Collection<? extends T> col,
java.util.function.BiPredicate<T,T> matcher)
Create a matcher that will check that an item is contained in the specified collection.
|
static org.hamcrest.Matcher<java.lang.Object> |
matches(java.util.regex.Pattern pattern)
Create a matcher that will check that string representation of any object
matches specified pattern.
|
static org.hamcrest.Matcher<java.lang.Object> |
matches(java.lang.String pattern)
Create a matcher that will check that string representation of any object
matches specified regexp pattern.
|
static org.hamcrest.Matcher<java.lang.Throwable> |
notExpected()
Create a matcher that will check that an exception is
null. |
static org.hamcrest.Matcher<java.lang.Object> |
nullConsistentWith(java.lang.Object value)
Create a matcher that will check that tested item and specified value are either both consistently nulls,
or both consistently not-nulls.
|
static <T> org.hamcrest.Matcher<T> |
reflectivelyEqualTo(T item)
Create a matcher that will check that tested item and specified value are equal
according to the
ComparisonPerformers.REFLECTIVE_EQUALS performer. |
static org.hamcrest.Matcher<java.lang.Throwable> |
throwableOfType(java.lang.Class<? extends java.lang.Throwable> type)
Create a matcher that will check that an exception is an instance of the specified type.
|
public static <T> org.hamcrest.Matcher<T> equalTo(T item,
ComparisonPerformer<? super T> performer)
ComparisonPerformer.public static <T> org.hamcrest.Matcher<T> deeplyEqualTo(T item)
ComparisonPerformers.DEEP_EQUALS performer.public static <T> org.hamcrest.Matcher<T> reflectivelyEqualTo(T item)
ComparisonPerformers.REFLECTIVE_EQUALS performer.public static <T> org.hamcrest.Matcher<T> consistentWith(T value,
org.hamcrest.Matcher<? super T> matcher)
nullConsistentWith(Object),
ConsistencyMatcherpublic static org.hamcrest.Matcher<java.lang.Object> nullConsistentWith(java.lang.Object value)
Create a matcher that will check that tested item and specified value are either both consistently nulls, or both consistently not-nulls.
Equal to consistentWith(Object, Matcher) with Matchers.nullValue() as delegate.
ConsistencyMatcherpublic static org.hamcrest.Matcher<java.lang.Object> matches(java.lang.String pattern)
java.lang.NullPointerException - if specified string is nullmatches(Pattern),
RegexpMatcherpublic static org.hamcrest.Matcher<java.lang.Object> matches(java.util.regex.Pattern pattern)
java.lang.NullPointerException - if specified pattern is nullmatches(String),
RegexpMatcherpublic static org.hamcrest.Matcher<java.lang.Throwable> throwableOfType(java.lang.Class<? extends java.lang.Throwable> type)
notExpected(),
ThrowableMatcherpublic static org.hamcrest.Matcher<java.lang.Throwable> notExpected()
null.
And will set asserted throwable as cause of the result.throwableOfType(Class),
ThrowableMatcherpublic static <T> org.hamcrest.Matcher<java.util.Collection<? extends T>> hasItem(T item,
java.util.function.BiPredicate<T,T> matcher)
Create a matcher that will check that a collection contains the specified item. Specified predicate is used to check elements equality.
Note: matcher will throw an NPE if matched against a null value!
java.lang.NullPointerException - if specified predicate is nullpublic static <T> org.hamcrest.Matcher<java.util.Collection<? extends T>> hasAnyItem(java.util.Collection<T> items)
hasAnyItem(Collection, BiPredicate) with Objects.deepEquals(Object, Object)
used as a predicate.
Note: matcher will throw an NPE if matched against a null value!
java.lang.NullPointerException - if specified collection is nulljava.lang.IllegalArgumentException - if specified collection is emptypublic static <T> org.hamcrest.Matcher<java.util.Collection<? extends T>> hasAnyItem(java.util.Collection<T> items,
java.util.function.BiPredicate<T,T> matcher)
Create a matcher that will check that a collection contains any one of the specified item. Specified predicate is used to check elements equality.
Note: matcher will throw an NPE if matched against a null value!
java.lang.NullPointerException - if specified collection or specified predicate is nulljava.lang.IllegalArgumentException - if specified collection is emptyhasAnyItem(Collection)public static <T> org.hamcrest.Matcher<T> isIn(java.util.Collection<? extends T> col,
java.util.function.BiPredicate<T,T> matcher)
java.lang.NullPointerException - if specified collection or predicate is nullpublic static <T,V> org.hamcrest.Matcher<V> convert(org.hamcrest.Matcher<T> m,
java.util.function.Function<V,T> f)
java.lang.NullPointerException - if specified matcher or function is null