org.prevayler.implementation.clock
Class BrokenClock

java.lang.Object
  extended by 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
           
 
Constructor Summary
BrokenClock()
           
BrokenClock(Date time)
           
 
Method Summary
 void advanceTo(Date newTime)
           
 Date time()
          Tells the time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_millis

protected long _millis
Constructor Detail

BrokenClock

public BrokenClock()

BrokenClock

public BrokenClock(Date time)
Method Detail

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.