StopWatchTest.testGetDuration() now runs in 2 milliseconds instead of
550.
This commit is contained in:
parent
586358fb0e
commit
21f0069882
|
@ -200,8 +200,10 @@ public class StopWatchTest extends AbstractLangTest {
|
||||||
assertEquals(Duration.ZERO, watch.getDuration());
|
assertEquals(Duration.ZERO, watch.getDuration());
|
||||||
assertEquals(ZERO_TIME_ELAPSED, watch.toString());
|
assertEquals(ZERO_TIME_ELAPSED, watch.toString());
|
||||||
watch.start();
|
watch.start();
|
||||||
sleep(MILLIS_550);
|
sleep(Duration.ofMillis(1));
|
||||||
assertThat("watch.getDuration()", watch.getDuration().toMillis(), lessThan(2000L));
|
final long nanos = watch.getNanoTime();
|
||||||
|
assertTrue(nanos > 0, () -> "getNanoTime(): " + nanos);
|
||||||
|
assertTrue(DurationUtils.isPositive(watch.getDuration()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue