com.google.common.testing
Class FakeTicker

java.lang.Object
  extended by com.google.common.base.Ticker
      extended by com.google.common.testing.FakeTicker

@Beta
@GwtCompatible
public class FakeTicker
extends Ticker

A Ticker whose value can be advanced programmatically in test.

This class is thread-safe.

Since:
10.0
Author:
Jige Yu

Constructor Summary
FakeTicker()
           
 
Method Summary
 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()
          Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.
 
Methods inherited from class com.google.common.base.Ticker
systemTicker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FakeTicker

public FakeTicker()
Method Detail

advance

public FakeTicker advance(long time,
                          TimeUnit timeUnit)
Advances the ticker value by time in timeUnit.


advance

public FakeTicker advance(long nanoseconds)
Advances the ticker value by nanoseconds.


read

public long read()
Description copied from class: Ticker
Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.

Specified by:
read in class Ticker


Copyright © 2010-2014. All Rights Reserved.