Skip to content

Commit 2561d57

Browse files
author
edelgadoh
committed
Adding labels to split StopWatch feature - checkstyle
1 parent 61d73f8 commit 2561d57

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main/java/org/apache/commons/lang3/time/StopWatch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ private void processSplits(TimeUnit timeUnit) {
864864
}
865865

866866
for (int i = 0; i < splits.size() - 1; i++) {
867-
final Duration duration = Duration.between(splits.get(i).getStartTime(), splits.get(i+1).getStartTime());
867+
final Duration duration = Duration.between(splits.get(i).getStartTime(), splits.get(i + 1).getStartTime());
868868
splits.get(i).setDuration(timeUnit == TimeUnit.NANOSECONDS ? duration.toNanos() : duration.toMillis());
869869
}
870870

src/test/java/org/apache/commons/lang3/time/StopWatchTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ void testSplitsWithStringLabels() {
520520
watch.split(thirdLabel);
521521
ThreadUtils.sleepQuietly(Duration.ofMillis(thirdSleepTime));
522522

523-
List<StopWatch.Split> splits = watch.getProcessedSplits();
523+
final List<StopWatch.Split> splits = watch.getProcessedSplits();
524524

525525
// check sizes
526526
assertEquals(3, splits.size());
@@ -537,8 +537,8 @@ void testSplitsWithStringLabels() {
537537
assertTrue(splits.get(2).getDuration() >= 100 && splits.get(2).getDuration() < 100 + margin);
538538

539539
// check report
540-
String report = watch.getReport();
541-
String updatedReport = report.replaceAll("4\\d\\d", "4**").replaceAll("2\\d\\d", "2**").replaceAll("1\\d\\d", "1**");
540+
final String report = watch.getReport();
541+
final String updatedReport = report.replaceAll("4\\d\\d", "4**").replaceAll("2\\d\\d", "2**").replaceAll("1\\d\\d", "1**");
542542

543543
assertEquals(
544544
"\none 00:00:00.4**" +
@@ -567,7 +567,7 @@ void testSplitsWithIntLabels() {
567567
watch.split(thirdLabel);
568568
ThreadUtils.sleepQuietly(Duration.ofMillis(thirdSleepTime));
569569

570-
List<StopWatch.Split> splits = watch.getProcessedSplits();
570+
final List<StopWatch.Split> splits = watch.getProcessedSplits();
571571

572572
// check sizes
573573
assertEquals(3, splits.size());
@@ -584,8 +584,8 @@ void testSplitsWithIntLabels() {
584584
assertTrue(splits.get(2).getDuration() >= 100 && splits.get(2).getDuration() < 100 + margin);
585585

586586
// check report
587-
String report = watch.getReport();
588-
String updatedReport = report.replaceAll("4\\d\\d", "4**").replaceAll("2\\d\\d", "2**").replaceAll("1\\d\\d", "1**");
587+
final String report = watch.getReport();
588+
final String updatedReport = report.replaceAll("4\\d\\d", "4**").replaceAll("2\\d\\d", "2**").replaceAll("1\\d\\d", "1**");
589589

590590
assertEquals(
591591
"\n1 00:00:00.4**" +
@@ -605,7 +605,7 @@ void testNanoSplitsWithLabel() {
605605
watch.split("eating");
606606
ThreadUtils.sleepQuietly(Duration.ofMillis(200));
607607

608-
List<StopWatch.Split> splits = watch.getNanoProcessedSplits();
608+
final List<StopWatch.Split> splits = watch.getNanoProcessedSplits();
609609

610610
// check sizes
611611
assertEquals(2, splits.size());
@@ -616,8 +616,8 @@ void testNanoSplitsWithLabel() {
616616
assertTrue(splits.get(1).getDuration() >= 200000000 && splits.get(1).getDuration() < 200000000 + margin);
617617

618618
// check report
619-
String report = watch.getNanoReport();
620-
String updatedReport = report.replaceAll(" 10\\d+", " 10*******").replaceAll(" 20\\d+", " 20*******");
619+
final String report = watch.getNanoReport();
620+
final String updatedReport = report.replaceAll(" 10\\d+", " 10*******").replaceAll(" 20\\d+", " 20*******");
621621

622622
assertEquals(
623623
"\ncoding 10*******" +

0 commit comments

Comments
 (0)