parent
b23c2d3836
commit
66d19b140e
|
@ -302,14 +302,14 @@ public class StopWatchTest extends AbstractLangTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSimple() throws InterruptedException {
|
public void testSimple() throws InterruptedException {
|
||||||
final StopWatch watch = StopWatch.createStarted();
|
final StopWatch watch = StopWatch.createStarted();
|
||||||
sleep(MILLIS_550);
|
final Duration sleepDuration = MILLIS_550;
|
||||||
|
sleep(sleepDuration);
|
||||||
watch.stop();
|
watch.stop();
|
||||||
final long time = watch.getTime();
|
final long time = watch.getTime();
|
||||||
final Duration duration = watch.getDuration();
|
final Duration duration = watch.getDuration();
|
||||||
assertEquals(time, watch.getTime());
|
assertEquals(time, watch.getTime());
|
||||||
assertEquals(duration, watch.getDuration());
|
assertEquals(duration, watch.getDuration());
|
||||||
assertThat("time", time, allOf(greaterThanOrEqualTo(500L), lessThan(2000L)));
|
assertTrue(duration.compareTo(sleepDuration) > 0);
|
||||||
assertThat("duration", duration.toMillis(), allOf(greaterThanOrEqualTo(500L), lessThan(2000L)));
|
|
||||||
watch.reset();
|
watch.reset();
|
||||||
assertEquals(0, watch.getTime());
|
assertEquals(0, watch.getTime());
|
||||||
assertEquals(Duration.ZERO, watch.getDuration());
|
assertEquals(Duration.ZERO, watch.getDuration());
|
||||||
|
|
Loading…
Reference in New Issue