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.


构造方法摘要
IgnoreDatesComparator()
           
 
方法摘要
 boolean canCompare(Object left, Object right)
          Returns true if both objects are null or both objects are Date instances.
 Difference compare(Object left, Object right, boolean onlyFirstDifference, ReflectionComparator reflectionComparator)
          Compares the given dates.
 
从类 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 object
right - 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 date
right - The right date
onlyFirstDifference - True if only the first difference should be returned
reflectionComparator - 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.