use of java.util.concurrent.TimeUnit in project guava by google.
the class FakeTickerTest method testAutoIncrementStep_resetToZero.
public void testAutoIncrementStep_resetToZero() {
FakeTicker ticker = new FakeTicker().setAutoIncrementStep(10, TimeUnit.NANOSECONDS);
assertEquals(0, ticker.read());
assertEquals(10, ticker.read());
assertEquals(20, ticker.read());
for (TimeUnit timeUnit : EnumSet.allOf(TimeUnit.class)) {
ticker.setAutoIncrementStep(0, timeUnit);
assertEquals("Expected no auto-increment when setting autoIncrementStep to 0 " + timeUnit, 30, ticker.read());
}
}
use of java.util.concurrent.TimeUnit in project guava by hceylan.
the class MapMakerInternalMapTest method testSetExpireAfterAccess.
public void testSetExpireAfterAccess() {
long duration = 42;
TimeUnit unit = SECONDS;
MapMakerInternalMap<Object, Object> map = makeMap(createMapMaker().expireAfterAccess(duration, unit));
assertEquals(unit.toNanos(duration), map.expireAfterAccessNanos);
}
use of java.util.concurrent.TimeUnit in project guava by hceylan.
the class MapMakerInternalMapTest method testSetExpireAfterWrite.
public void testSetExpireAfterWrite() {
long duration = 42;
TimeUnit unit = SECONDS;
MapMakerInternalMap<Object, Object> map = makeMap(createMapMaker().expireAfterWrite(duration, unit));
assertEquals(unit.toNanos(duration), map.expireAfterWriteNanos);
}
use of java.util.concurrent.TimeUnit in project guava by hceylan.
the class LocalCacheTest method testSetExpireAfterAccess.
public void testSetExpireAfterAccess() {
long duration = 42;
TimeUnit unit = TimeUnit.SECONDS;
LocalCache<Object, Object> map = makeLocalCache(createCacheBuilder().expireAfterAccess(duration, unit));
assertEquals(unit.toNanos(duration), map.expireAfterAccessNanos);
}
use of java.util.concurrent.TimeUnit in project guava by hceylan.
the class LocalCacheTest method testSetExpireAfterWrite.
public void testSetExpireAfterWrite() {
long duration = 42;
TimeUnit unit = TimeUnit.SECONDS;
LocalCache<Object, Object> map = makeLocalCache(createCacheBuilder().expireAfterWrite(duration, unit));
assertEquals(unit.toNanos(duration), map.expireAfterWriteNanos);
}
Aggregations