aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-07-06 14:52:23 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2016-07-06 14:54:32 +0200
commite6203dbc6e7e1d8516dc8243afdaf3a7c41270a6 (patch)
tree3f9155bb2fb3638144c997f7db2029b4f433cfa3 /server/sonar-server
parent31afeda58d4b373438fc49b95ff15fb17f469a08 (diff)
downloadsonarqube-e6203dbc6e7e1d8516dc8243afdaf3a7c41270a6.tar.gz
sonarqube-e6203dbc6e7e1d8516dc8243afdaf3a7c41270a6.zip
SONAR-7869 api/measures/* formats correctly big MILLISEC metrics
Diffstat (limited to 'server/sonar-server')
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasureValueFormatter.java4
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/measure/ws/MeasureValueFormatterTest.java3
2 files changed, 4 insertions, 3 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasureValueFormatter.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasureValueFormatter.java
index fcf5e28bd22..84dfacc77a2 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasureValueFormatter.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/MeasureValueFormatter.java
@@ -39,8 +39,8 @@ class MeasureValueFormatter {
case BOOL:
return formatBoolean(doubleValue);
case INT:
- case MILLISEC:
return formatInteger(doubleValue);
+ case MILLISEC:
case WORK_DUR:
return formatLong(doubleValue);
case FLOAT:
@@ -64,8 +64,8 @@ class MeasureValueFormatter {
case BOOL:
return formatBoolean(value);
case INT:
- case MILLISEC:
return formatInteger(value);
+ case MILLISEC:
case WORK_DUR:
return formatLong(value);
case FLOAT:
diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MeasureValueFormatterTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MeasureValueFormatterTest.java
index 9ad6ea678e5..e2c7d8f3669 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MeasureValueFormatterTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MeasureValueFormatterTest.java
@@ -50,6 +50,7 @@ public class MeasureValueFormatterTest {
assertThat(formatNumericalValue(1_000.123d, newMetric(FLOAT))).isEqualTo("1000.123");
assertThat(formatNumericalValue(1_000.0d, newMetric(INT))).isEqualTo("1000");
assertThat(formatNumericalValue(1_000.0d, newMetric(WORK_DUR))).isEqualTo("1000");
+ assertThat(formatNumericalValue(6_000_000_000_000.0d, newMetric(MILLISEC))).isEqualTo("6000000000000");
}
@Test
@@ -57,8 +58,8 @@ public class MeasureValueFormatterTest {
assertThat(formatMeasureValue(newNumericMeasure(-1.0d), newMetric(BOOL))).isEqualTo("false");
assertThat(formatMeasureValue(newNumericMeasure(1.0d), newMetric(BOOL))).isEqualTo("true");
assertThat(formatMeasureValue(newNumericMeasure(1000.123d), newMetric(PERCENT))).isEqualTo("1000.123");
- assertThat(formatMeasureValue(newNumericMeasure(1000d), newMetric(MILLISEC))).isEqualTo("1000");
assertThat(formatMeasureValue(newNumericMeasure(1000.0d), newMetric(WORK_DUR))).isEqualTo("1000");
+ assertThat(formatMeasureValue(newNumericMeasure(6_000_000_000_000.0d), newMetric(MILLISEC))).isEqualTo("6000000000000");
assertThat(formatMeasureValue(newTextMeasure("text-value"), newMetric(DATA))).isEqualTo("text-value");
}