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 b4e4c40af Faster StopWatchTest.testStopInstantSimple()
b4e4c40af is described below

commit b4e4c40af1672717e687e74db70daf71e035f9b3
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed Sep 4 11:32:53 2024 -0400

    Faster StopWatchTest.testStopInstantSimple()
    
    - Replace Matcher calls with sane assertTrue()
---
 src/test/java/org/apache/commons/lang3/time/StopWatchTest.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 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 70c32a3e3..50ec7b7d5 100644
--- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java
@@ -351,13 +351,14 @@ public class StopWatchTest extends AbstractLangTest {
     public void testStopInstantSimple() throws InterruptedException {
         final StopWatch watch = StopWatch.createStarted();
         final long testStartMillis = System.currentTimeMillis();
-        sleep(MILLIS_550);
+        sleep(TWO_MILLISECOND);
         watch.stop();
         final long testEndMillis = System.currentTimeMillis();
         final Instant stopTime = watch.getStopInstant();
         assertEquals(stopTime, watch.getStopInstant());
-        assertThat("stopTime", stopTime,
-                
allOf(greaterThanOrEqualTo(Instant.ofEpochMilli(testStartMillis)), 
lessThanOrEqualTo(Instant.ofEpochMilli(testEndMillis))));
+        // Only less than, not equal
+        assertTrue(testStartMillis < testEndMillis);
+        
assertTrue(Instant.ofEpochMilli(testStartMillis).isBefore(Instant.ofEpochMilli(testEndMillis)));
     }
 
     @Test

Reply via email to