diff --git a/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java b/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java index 925d05bcc..1aa4d9879 100644 --- a/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java +++ b/src/test/java/org/apache/commons/lang3/CharUtilsPerfRun.java @@ -99,21 +99,21 @@ public class CharUtilsPerfRun { private void run() { this.printSysInfo(); - long start; - start = System.currentTimeMillis(); - this.printlnTotal("Do nothing", start); + long startMillis; + startMillis = System.currentTimeMillis(); + this.printlnTotal("Do nothing", startMillis); run_CharUtils_isAsciiNumeric(WARM_UP); - start = System.currentTimeMillis(); + startMillis = System.currentTimeMillis(); run_CharUtils_isAsciiNumeric(COUNT); - this.printlnTotal("run_CharUtils_isAsciiNumeric", start); + this.printlnTotal("run_CharUtils_isAsciiNumeric", startMillis); run_inlined_CharUtils_isAsciiNumeric(WARM_UP); - start = System.currentTimeMillis(); + startMillis = System.currentTimeMillis(); run_inlined_CharUtils_isAsciiNumeric(COUNT); - this.printlnTotal("run_inlined_CharUtils_isAsciiNumeric", start); + this.printlnTotal("run_inlined_CharUtils_isAsciiNumeric", startMillis); run_CharSet(WARM_UP); - start = System.currentTimeMillis(); + startMillis = System.currentTimeMillis(); run_CharSet(COUNT); - this.printlnTotal("run_CharSet", start); + this.printlnTotal("run_CharSet", startMillis); } private int run_CharSet(final int loopCount) { @@ -149,8 +149,8 @@ public class CharUtilsPerfRun { return t; } - private void printlnTotal(final String prefix, final long start) { - final long total = System.currentTimeMillis() - start; - System.out.println(prefix + ": " + NumberFormat.getInstance().format(total) + " milliseconds."); + private void printlnTotal(final String prefix, final long startMillis) { + final long totalMillis = System.currentTimeMillis() - startMillis; + System.out.println(prefix + ": " + NumberFormat.getInstance().format(totalMillis) + " milliseconds."); } } diff --git a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java index 09df879d0..03e4f284e 100644 --- a/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/RandomStringUtilsTest.java @@ -142,9 +142,9 @@ public class RandomStringUtilsTest { assertEquals(50, r2.length(), "random(50) length"); assertTrue(!r1.equals(r2), "!r1.equals(r2)"); - final long seed = System.currentTimeMillis(); - r1 = RandomStringUtils.random(50, 0, 0, true, true, null, new Random(seed)); - r2 = RandomStringUtils.random(50, 0, 0, true, true, null, new Random(seed)); + final long seedMillis = System.currentTimeMillis(); + r1 = RandomStringUtils.random(50, 0, 0, true, true, null, new Random(seedMillis)); + r2 = RandomStringUtils.random(50, 0, 0, true, true, null, new Random(seedMillis)); assertEquals(r1, r2, "r1.equals(r2)"); r1 = RandomStringUtils.random(0); @@ -153,8 +153,8 @@ public class RandomStringUtilsTest { @Test public void testLANG805() { - final long seed = System.currentTimeMillis(); - assertEquals("aaa", RandomStringUtils.random(3, 0, 0, false, false, new char[]{'a'}, new Random(seed))); + final long seedMillis = System.currentTimeMillis(); + assertEquals("aaa", RandomStringUtils.random(3, 0, 0, false, false, new char[]{'a'}, new Random(seedMillis))); } @Test diff --git a/src/test/java/org/apache/commons/lang3/concurrent/locks/LockingVisitorsTest.java b/src/test/java/org/apache/commons/lang3/concurrent/locks/LockingVisitorsTest.java index ab06e6a53..b45c059df 100644 --- a/src/test/java/org/apache/commons/lang3/concurrent/locks/LockingVisitorsTest.java +++ b/src/test/java/org/apache/commons/lang3/concurrent/locks/LockingVisitorsTest.java @@ -48,7 +48,7 @@ public class LockingVisitorsTest { final boolean[] booleanValues, final LockVisitor visitor) throws InterruptedException { final boolean[] runningValues = new boolean[10]; - final long startTime = System.currentTimeMillis(); + final long startTimeMillis = System.currentTimeMillis(); for (int i = 0; i < booleanValues.length; i++) { final int index = i; final FailableConsumer consumer = b -> { @@ -70,12 +70,12 @@ public class LockingVisitorsTest { while (containsTrue(runningValues)) { Thread.sleep(100); } - final long endTime = System.currentTimeMillis(); + final long endTimeMillis = System.currentTimeMillis(); for (final boolean booleanValue : booleanValues) { assertTrue(booleanValue); } // WRONG assumption - // runTimeCheck.accept(endTime - startTime); + // runTimeCheck.accept(endTimeMillis - startTimeMillis); } protected void set(final boolean[] booleanArray, final int offset, final boolean value) { diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java index 2de4dff56..df59b5bf6 100644 --- a/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java +++ b/src/test/java/org/apache/commons/lang3/time/FastDateFormatTest.java @@ -262,13 +262,13 @@ public class FastDateFormatTest { try { final Date date = new Date(); - final long t0 = System.currentTimeMillis(); + final long t0Millis = System.currentTimeMillis(); final String formattedDate = printer.format(date); - totalElapsed.addAndGet(0, System.currentTimeMillis() - t0); + totalElapsed.addAndGet(0, System.currentTimeMillis() - t0Millis); - final long t1 = System.currentTimeMillis(); + final long t1Millis = System.currentTimeMillis(); final Object pd = parser.parseObject(formattedDate); - totalElapsed.addAndGet(1, System.currentTimeMillis() - t1); + totalElapsed.addAndGet(1, System.currentTimeMillis() - t1Millis); if (!date.equals(pd)) { failures.incrementAndGet(); 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 f2a3434fc..60d309072 100644 --- a/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java +++ b/src/test/java/org/apache/commons/lang3/time/StopWatchTest.java @@ -174,14 +174,14 @@ public class StopWatchTest { @Test public void testGetStartTime() { - final long beforeStopWatch = System.currentTimeMillis(); + final long beforeStopWatchMillis = System.currentTimeMillis(); final StopWatch watch = new StopWatch(); assertThrows(IllegalStateException.class, watch::getStartTime, "Calling getStartTime on an unstarted StopWatch should throw an exception"); watch.start(); watch.getStartTime(); - assertTrue(watch.getStartTime() >= beforeStopWatch); + assertTrue(watch.getStartTime() >= beforeStopWatchMillis); watch.reset(); assertThrows(IllegalStateException.class, watch::getStartTime,