public class ComparisonPerformers
extends java.lang.Object
performers package and
easy-access for its elements.| Modifier and Type | Field and Description |
|---|---|
static ComparisonPerformer<java.lang.Object> |
DEEP_EQUALS
Basic performer that performs
Objects.deepEquals(Object, Object) and returns basic ComparisonResult. |
static ComparisonPerformer<java.lang.Number> |
DOUBLE_MATH_EQUALS
Performer uses
DoubleMath.equals(Double, Double) to compare any specified numbers as doubles. |
static ReflectiveComparisonPerformer |
REFLECTIVE_EQUALS
Just a static access-instance of the
ReflectiveComparisonPerformer that performs full-depth
recursive reflective comparison by fields. |
| Modifier and Type | Method and Description |
|---|---|
static <T> ArrayComparisonPerformer<T> |
array(ComparisonPerformer<? super T> elementPerformer)
Create instance of the special case performer wrapper to handle arrays.
|
static <T> GettersDynamicPerformerBuilder<T> |
buildGetters(java.lang.Class<T> type)
Create instance of the
GettersDynamicPerformerBuilder that filters in only public methods
and with field GettersDynamicPerformerBuilder.DEFAULT_METHODS added as excluding predicate. |
static <T> PropertyDynamicPerformerBuilder<T> |
buildProperties(java.lang.Class<T> type)
Create instance of the
PropertyDynamicPerformerBuilder. |
static <T> ComparisonPerformer<T> |
fromPredicate(java.util.function.BiPredicate<T,T> predicate)
Create ComparisonPerformer that executes specified predicate and returns simple
ComparisonResult |
static <T> ListComparisonPerformer<T> |
list(ComparisonPerformer<T> elementPerformer)
Create instance of the special case performer wrapper to handle lists.
|
static <T> MapComparisonPerformer<T> |
map(ComparisonPerformer<? super T> elementPerformer)
Create instance of the special case performer wrapper to handle maps.
|
static <T> ComparisonResult |
safePerform(T actual,
T expected,
ComparisonPerformer<? super T> performer)
If execution of the specified performer will cause any exception -
ComparisonFail will be returned. |
static <T> SetComparisonPerformer<T> |
set(ComparisonPerformer<? super T> elementPerformer)
Create instance of the special case performer wrapper to handle collections.
|
public static final ComparisonPerformer<java.lang.Object> DEEP_EQUALS
Objects.deepEquals(Object, Object) and returns basic ComparisonResult.
Might be used as default fallback performer for recursive, or delegative functionality.public static final ComparisonPerformer<java.lang.Number> DOUBLE_MATH_EQUALS
DoubleMath.equals(Double, Double) to compare any specified numbers as doubles.public static final ReflectiveComparisonPerformer REFLECTIVE_EQUALS
Just a static access-instance of the ReflectiveComparisonPerformer that performs full-depth
recursive reflective comparison by fields.
Might be used without any restrictions.
public static <T> ComparisonPerformer<T> fromPredicate(java.util.function.BiPredicate<T,T> predicate)
ComparisonResultpublic static <T> ArrayComparisonPerformer<T> array(ComparisonPerformer<? super T> elementPerformer)
public static <T> ListComparisonPerformer<T> list(ComparisonPerformer<T> elementPerformer)
public static <T> SetComparisonPerformer<T> set(ComparisonPerformer<? super T> elementPerformer)
public static <T> MapComparisonPerformer<T> map(ComparisonPerformer<? super T> elementPerformer)
public static <T> PropertyDynamicPerformerBuilder<T> buildProperties(java.lang.Class<T> type)
PropertyDynamicPerformerBuilder.
No additional configuration is performed.public static <T> GettersDynamicPerformerBuilder<T> buildGetters(java.lang.Class<T> type)
Create instance of the GettersDynamicPerformerBuilder that filters in only public methods
and with field GettersDynamicPerformerBuilder.DEFAULT_METHODS added as excluding predicate.
Note: builder created by this method will already have a requirement filter for public methods, it means that any non-public method cannot be processed by it! Use constructor manually to create a builder with different configuration.
Note: builder created by this method will already contain one excluding filter, and it will exclude all 'default' getters from the Object class.
public static <T> ComparisonResult safePerform(T actual, T expected, ComparisonPerformer<? super T> performer)
ComparisonFail will be returned.
Method guaranteed to not throw any exceptions, unless specified performer is null.