From 45f2ceaf3c0111c731ce4cd9233803175ac16783 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Wed, 4 Sep 2024 11:00:48 -0400 Subject: [PATCH] Refactor constant --- src/test/java/org/apache/commons/lang3/time/StopWatchTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 5a3fa48c2..04f58d547 100644 --- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java +++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java @@ -44,6 +44,7 @@ import org.junit.jupiter.api.Test; */ public class StopWatchTest extends AbstractLangTest { + private static final Duration ONE_MILLISECOND = Duration.ofMillis(1); private static final Duration MILLIS_200 = Duration.ofMillis(200); private static final Duration MILLIS_550 = Duration.ofMillis(550); private static final String MESSAGE = "Baking cookies"; @@ -200,7 +201,7 @@ public class StopWatchTest extends AbstractLangTest { assertEquals(Duration.ZERO, watch.getDuration()); assertEquals(ZERO_TIME_ELAPSED, watch.toString()); watch.start(); - sleep(Duration.ofMillis(1)); + sleep(ONE_MILLISECOND); final long nanos = watch.getNanoTime(); assertTrue(nanos > 0, () -> "getNanoTime(): " + nanos); assertTrue(DurationUtils.isPositive(watch.getDuration()));