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 15:32:58 UTC
(commons-lang) branch master updated: Faster StopWatchTest.testStopInstantSimple()
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 <ga...@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