From b1c0793144ba94bb0678b25ff9a44adc8816d4fd Mon Sep 17 00:00:00 2001 From: Duarte Meneses Date: Thu, 7 Jul 2016 13:15:06 +0200 Subject: [PATCH] SONAR-7354 Display total analysis time in scanners --- .../java/org/sonar/scanner/bootstrap/GlobalContainer.java | 6 +++--- .../org/sonar/scanner/bootstrap/GlobalContainerTest.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java index 23d6208c881..605a067c66f 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/GlobalContainer.java @@ -121,11 +121,11 @@ public class GlobalContainer extends ComponentContainer { long ms = time % 1000; final String format; if (h > 0) { - format = "%1$d:%2$02d:%3$02d.%4$03ds"; + format = "%1$d:%2$02d:%3$02d.%4$03d s"; } else if (m > 0) { - format = "%2$d:%3$02d.%4$03ds"; + format = "%2$d:%3$02d.%4$03d s"; } else { - format = "%3$d.%4$03ds"; + format = "%3$d.%4$03d s"; } return String.format(format, h, m, s, ms); } diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalContainerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalContainerTest.java index 9143af92249..d94ed4df80a 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalContainerTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/GlobalContainerTest.java @@ -66,10 +66,10 @@ public class GlobalContainerTest { @Test public void shouldFormatTime() { - assertThat(GlobalContainer.formatTime(1 * 60 * 60 * 1000 + 2 * 60 * 1000 + 3 * 1000 + 400)).isEqualTo("1:02:03.400s"); - assertThat(GlobalContainer.formatTime(2 * 60 * 1000 + 3 * 1000 + 400)).isEqualTo("2:03.400s"); - assertThat(GlobalContainer.formatTime(3 * 1000 + 400)).isEqualTo("3.400s"); - assertThat(GlobalContainer.formatTime(400)).isEqualTo("0.400s"); + assertThat(GlobalContainer.formatTime(1 * 60 * 60 * 1000 + 2 * 60 * 1000 + 3 * 1000 + 400)).isEqualTo("1:02:03.400 s"); + assertThat(GlobalContainer.formatTime(2 * 60 * 1000 + 3 * 1000 + 400)).isEqualTo("2:03.400 s"); + assertThat(GlobalContainer.formatTime(3 * 1000 + 400)).isEqualTo("3.400 s"); + assertThat(GlobalContainer.formatTime(400)).isEqualTo("0.400 s"); } @BatchSide -- 2.39.5