Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.whaka.asserts;
import java.util.Collection;
import java.util.Objects;
import java.util.function.BiPredicate;
import java.util.function.Function;
import java.util.regex.Pattern;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
import org.whaka.asserts.matcher.ComparisonMatcher;
import org.whaka.asserts.matcher.ConsistencyMatcher;
import org.whaka.asserts.matcher.FunctionalMatcher;
import org.whaka.asserts.matcher.RegexpMatcher;
import org.whaka.asserts.matcher.ThrowableMatcher;
import org.whaka.util.UberCollections;
import org.whaka.util.reflection.comparison.ComparisonPerformer;
import org.whaka.util.reflection.comparison.ComparisonPerformers;
import com.google.common.base.Preconditions;
/**
* Class provides static factory methods for custom Hamcrest matchers provided by the library.
*
* @see NumberMatchers
*/
public final class UberMatchers {
private UberMatchers() {
}
/**
* Create a matcher that will check that tested item and specified value are equal
* according to the specified {@link ComparisonPerformer}.
*
* @see #deeplyEqualTo(Object)
* @see #reflectivelyEqualTo(Object)
* @see ComparisonMatcher
* @see ComparisonPerformers
*/
public static Matcher equalTo(T item, ComparisonPerformer super T> performer) {
return new ComparisonMatcher<>(item, performer);
}
/**
* Create a matcher that will check that tested item and specified value are equal
* according to the {@link ComparisonPerformers#DEEP_EQUALS} performer.
*
* @see #equalTo(Object, ComparisonPerformer)
* @see #reflectivelyEqualTo(Object)
* @see ComparisonMatcher
* @see ComparisonPerformers
*/
public static Matcher deeplyEqualTo(T item) {
return equalTo(item, ComparisonPerformers.DEEP_EQUALS);
}
/**
* Create a matcher that will check that tested item and specified value are equal
* according to the {@link ComparisonPerformers#REFLECTIVE_EQUALS} performer.
*
* @see #equalTo(Object, ComparisonPerformer)
* @see #deeplyEqualTo(Object)
* @see ComparisonMatcher
* @see ComparisonPerformers
*/
public static Matcher reflectivelyEqualTo(T item) {
return equalTo(item, ComparisonPerformers.REFLECTIVE_EQUALS);
}
/**
* 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.
*
* @see #nullConsistentWith(Object)
* @see ConsistencyMatcher
*/
public static Matcher consistentWith(T value, Matcher super T> matcher) {
return new ConsistencyMatcher(value, matcher);
}
/**
*
Create a matcher that will check that tested item and specified value are either both consistently nulls,
* or both consistently not-nulls.
*
*
Equal to {@link #consistentWith(Object, Matcher)} with {@link Matchers#nullValue()} as delegate.
*
* @see ConsistencyMatcher
*/
public static Matcher