| org.unitils.easymock.util.ReflectionArgumentMatcher
ReflectionArgumentMatcher | public class ReflectionArgumentMatcher extends Equals (Code) | | An easy mock argument matcher to check whether 2 objects are equal by comparing all fields of the objects using
reflection.
The (combination of) comparator modes specify how strict the comparison must be:
- ignore defaults: compare only arguments (and inner values) that have a non default value (eg null) as exepected value
- lenient dates: do not compare actual date values, just that they both have a value or not
- lenient order: order is not important when comparing collections or arrays
author: Tim Ducheyne author: Filip Neven See Also: ReflectionComparator See Also: ReflectionComparatorMode |
Method Summary | |
public boolean | matches(Object actual) Checks whether the given actual value is equal to the expected value.
A reflection comparator is used to compare both values. |
ReflectionArgumentMatcher | public ReflectionArgumentMatcher(T expected, ReflectionComparatorMode... modes)(Code) | | Creates a matcher for the expected argument value.
The modes specify how to compare the expected value with the actual value.
Parameters: expected - the argument value, not null Parameters: modes - the comparator modes |
matches | public boolean matches(Object actual)(Code) | | Checks whether the given actual value is equal to the expected value.
A reflection comparator is used to compare both values. The modes determine how
strict this comparison will be.
An assertion error is thrown if expected and actual did not match. This way, a more
detailed message can be provided.
Parameters: actual - the actual argument value true throws: AssertionError - in case expected and actual did not match |
|
|