|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.api.client.testing.http.FixedClock
public class FixedClock
A thread-safe fixed time implementation of the Clock to be used for unit testing.
Explicitly allows you to set the time to any arbitrary value.
Field Summary |
---|
Fields inherited from interface com.google.api.client.util.Clock |
---|
SYSTEM |
Constructor Summary | |
---|---|
FixedClock()
Initializes the FixedClock with 0 millis as start time. |
|
FixedClock(long startTime)
Initializes the FixedClock with the specified time. |
Method Summary | |
---|---|
long |
currentTimeMillis()
Returns the current time in milliseconds since midnight, January 1, 1970 UTC, to match the behavior of System.currentTimeMillis() . |
FixedClock |
setTime(long newTime)
Changes the time value this time provider is returning. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FixedClock()
public FixedClock(long startTime)
startTime
- time in milliseconds used for initialization.Method Detail |
---|
public FixedClock setTime(long newTime)
newTime
- New time in milliseconds.public long currentTimeMillis()
Clock
System.currentTimeMillis()
.
currentTimeMillis
in interface Clock
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |