org.unitils.reflectionassert.comparator.impl
Class IgnoreDefaultsComparator
java.lang.Object
org.unitils.reflectionassert.comparator.impl.IgnoreDefaultsComparator
- All Implemented Interfaces:
- Comparator
public class IgnoreDefaultsComparator
- extends Object
- implements Comparator
A comparator that filters out java-defaults.
If the left object is null, false or 0, both objects are considered equal.
This implements the IGNORE_DEFAULTS comparison mode.
- Author:
- Tim Ducheyne, Filip Neven
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IgnoreDefaultsComparator
public IgnoreDefaultsComparator()
canCompare
public boolean canCompare(Object left,
Object right)
- Returns true if the left object is a java default
- Specified by:
canCompare
in interface Comparator
- Parameters:
left
- The left objectright
- The right object
- Returns:
- True if left is null, false or 0
compare
public Difference compare(Object left,
Object right,
boolean onlyFirstDifference,
ReflectionComparator reflectionComparator)
- Always returns null: both objects are equal.
- Specified by:
compare
in interface Comparator
- Parameters:
left
- The left objectright
- The right objectonlyFirstDifference
- True if only the first difference should be returnedreflectionComparator
- The root comparator for inner comparisons, not null
- Returns:
- null
Copyright © 2011. All Rights Reserved.