@Beta @GwtCompatible public class FakeTicker extends com.google.common.base.Ticker
The ticker can be configured so that the time is incremented whenever read() is called:
see setAutoIncrementStep(long, java.util.concurrent.TimeUnit).
This class is thread-safe.
| Constructor and Description |
|---|
FakeTicker() |
| Modifier and Type | Method and Description |
|---|---|
FakeTicker |
advance(Duration duration)
Advances the ticker value by
duration. |
FakeTicker |
advance(long nanoseconds)
Advances the ticker value by
nanoseconds. |
FakeTicker |
advance(long time,
TimeUnit timeUnit)
Advances the ticker value by
time in timeUnit. |
long |
read() |
FakeTicker |
setAutoIncrementStep(Duration autoIncrementStep)
Sets the increment applied to the ticker whenever it is queried.
|
FakeTicker |
setAutoIncrementStep(long autoIncrementStep,
TimeUnit timeUnit)
Sets the increment applied to the ticker whenever it is queried.
|
public FakeTicker()
public FakeTicker advance(long time, TimeUnit timeUnit)
time in timeUnit.public FakeTicker advance(long nanoseconds)
nanoseconds.@GwtIncompatible public FakeTicker advance(Duration duration)
duration.public FakeTicker setAutoIncrementStep(long autoIncrementStep, TimeUnit timeUnit)
The default behavior is to auto increment by zero. i.e: The ticker is left unchanged when queried.
@GwtIncompatible public FakeTicker setAutoIncrementStep(Duration autoIncrementStep)
The default behavior is to auto increment by zero. i.e: The ticker is left unchanged when queried.
public long read()
read in class com.google.common.base.TickerCopyright © 2010–2019. All rights reserved.