org.test4j.hamcrest.matcher.property.comparator
类 IgnoreDatesComparator
java.lang.Object
org.test4j.hamcrest.matcher.property.comparator.IgnoreDatesComparator
- 所有已实现的接口:
- Comparator
public class IgnoreDatesComparator
- extends Object
- implements Comparator
Comparator that checks whether 2 dates are both null or not null, the actual time-value is not compared.
This can be useful when the actual time/date is not known is advance but you still want to check whether
a value has been set or not. E.g. a last modification timestamp in the databsse.
| 从类 java.lang.Object 继承的方法 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IgnoreDatesComparator
public IgnoreDatesComparator()
canCompare
public boolean canCompare(Object left,
Object right)
- Returns true if both objects are null or both objects are Date instances.
- 指定者:
- 接口
Comparator 中的 canCompare
- 参数:
left - The left objectright - The right object
- 返回:
- True if null or dates
compare
public Difference compare(Object left,
Object right,
boolean onlyFirstDifference,
ReflectionComparator reflectionComparator)
- Compares the given dates.
- 指定者:
- 接口
Comparator 中的 compare
- 参数:
left - The left dateright - The right dateonlyFirstDifference - True if only the first difference should be returnedreflectionComparator - The root comparator for inner comparisons, not null
- 返回:
- A difference if one of the dates is null and the other one not, else null
Copyright © 2013. All rights reserved.