blob: dc6d3b30cb2b0beb3d08cb0744669cd3f3a9efc7 (
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.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author Simon Thoresen Hult
*/
public class SystemTimerTestCase {
@Test
void requireThatClassIsInjectedByDefault() {
Timer timer = Guice.createInjector().getInstance(Timer.class);
assertTrue(timer instanceof SystemTimer);
}
@Test
void requireThatSystemTimerIsSane() {
long before = System.currentTimeMillis();
long millis = new SystemTimer().currentTimeMillis();
long after = System.currentTimeMillis();
assertTrue(before <= millis);
assertTrue(after >= millis);
}
}
|