blob: 52e25877402ac860bfc9a22f7b75dafe8acc6b2b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.core;
import com.google.inject.Guice;
import com.yahoo.jdisc.Timer;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
/**
* @author Simon Thoresen Hult
*/
public class SystemTimerTestCase {
@Test
public void requireThatClassIsInjectedByDefault() {
Timer timer = Guice.createInjector().getInstance(Timer.class);
assertTrue(timer instanceof SystemTimer);
}
@Test
public void requireThatSystemTimerIsSane() {
long before = System.currentTimeMillis();
long millis = new SystemTimer().currentTimeMillis();
long after = System.currentTimeMillis();
assertTrue(before <= millis);
assertTrue(after >= millis);
}
}
|