org.prevayler.implementation.clock
Class BrokenClock
java.lang.Object
org.prevayler.implementation.clock.BrokenClock
- All Implemented Interfaces:
- Clock
- Direct Known Subclasses:
- MachineClock
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);
Field Summary |
protected long |
_millis
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_millis
protected long _millis
BrokenClock
public BrokenClock()
BrokenClock
public BrokenClock(Date time)
time
public Date time()
- Description copied from interface:
Clock
- Tells the time.
- Specified by:
time
in interface Clock
- Returns:
- 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.
advanceTo
public void advanceTo(Date newTime)
Copyright © 2001-2013. All Rights Reserved.