You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/09/04 14:58:25 UTC
(commons-lang) branch master updated: StopWatchTest.testGetDuration() now runs in 2 milliseconds instead of 550.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new 21f006988 StopWatchTest.testGetDuration() now runs in 2 milliseconds instead of 550.
21f006988 is described below
commit 21f0069882bd79ca39cbac7554c07b4bc12f05cd
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed Sep 4 10:58:20 2024 -0400
StopWatchTest.testGetDuration() now runs in 2 milliseconds instead of
550.
---
src/test/java/org/apache/commons/lang3/time/StopWatchTest.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
index fddf9fcc7..1d8037d65 100644
--- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
@@ -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