- All Implemented Interfaces:
- Direct Known Subclasses:
public class BrokenClock
- extends Object
- implements Clock
A deterministic Clock that always returns the same time until it is forced to advance. This class is useful as a Clock mock in order to run automated tests involving date/time related rules. A new BrokenClock's time() starts off at new Date(0);
|Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected long _millis
public BrokenClock(Date time)
public Date time()
- Description copied from interface:
- Tells the time.
- Specified by:
time in interface
- A Date greater or equal to the one returned by the last call to this method. If the time is the same as the last call, the SAME Date object is returned rather than a new, equal one.
public void advanceTo(Date newTime)
Copyright © 2001-2013. All Rights Reserved.