public class ComparisonMatcher<T> extends ResultProvidingMatcher<T>
Matcher implementation that allows to perform object comparison using ComparisonPerformer
as delegate.
Note: matcher able to provide specific ComparisonAssertResult containing more
information about performed comparison.
ComparisonPerformers| Constructor and Description |
|---|
ComparisonMatcher(T value,
ComparisonPerformer<? super T> comparisonPerformer) |
| Modifier and Type | Method and Description |
|---|---|
void |
describeTo(org.hamcrest.Description description) |
ComparisonPerformer<? super T> |
getComparisonPerformer() |
T |
getValue() |
java.util.Optional<ComparisonAssertResult> |
matches(T item,
java.lang.String message,
java.lang.Throwable cause)
This method should return
Optional.empty() in case matcher successfully matched specified item. |
matchespublic ComparisonMatcher(T value, ComparisonPerformer<? super T> comparisonPerformer)
public T getValue()
public ComparisonPerformer<? super T> getComparisonPerformer()
public java.util.Optional<ComparisonAssertResult> matches(T item, java.lang.String message, java.lang.Throwable cause)
ResultProvidingMatcherOptional.empty() in case matcher successfully matched specified item.
Otherwise it should return an optional containing an instance of the AssertResult.matches in class ResultProvidingMatcher<T>public void describeTo(org.hamcrest.Description description)