|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.cosylab.util.MockTimeProvider
public class MockTimeProvider
Mock implementation of a TimeProvider, which returns pre-set time.
Especially useful in unit tests. Also supports auto-advance of time (1 second
by default).
| Constructor Summary | |
|---|---|
MockTimeProvider()
Constructor sets the initial mock time. |
|
| Method Summary | |
|---|---|
long |
getTimeInMillis()
|
void |
setAutoAdvance(long advance)
Set the amount of time (in milliseconds) by which return value of getTimeInMillis() will advance every time it is called. |
void |
setTimeInMillis(long millis)
Set the current time, which will be returned the next time when getTimeInMillis() is called. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MockTimeProvider()
| Method Detail |
|---|
public void setAutoAdvance(long advance)
advance - Mock time provider's auto advance (in milliseconds).public void setTimeInMillis(long millis)
getTimeInMillis() is called.
millis - Current time.public long getTimeInMillis()
getTimeInMillis in interface TimeProvider
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||