StopWatchTest.testGetDuration() now runs in 2 milliseconds instead of

550.
This commit is contained in:
Gary Gregory 2024-09-04 10:58:20 -04:00
parent 586358fb0e
commit 21f0069882
1 changed files with 4 additions and 2 deletions

View File

@ -200,8 +200,10 @@ public class StopWatchTest extends AbstractLangTest {
assertEquals(Duration.ZERO, watch.getDuration());
assertEquals(ZERO_TIME_ELAPSED, watch.toString());
watch.start();
sleep(MILLIS_550);
assertThat("watch.getDuration()", watch.getDuration().toMillis(), lessThan(2000L));
sleep(Duration.ofMillis(1));
final long nanos = watch.getNanoTime();
assertTrue(nanos > 0, () -> "getNanoTime(): " + nanos);
assertTrue(DurationUtils.isPositive(watch.getDuration()));
}
@Test