aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorssjenka <ssjenka@ops-slave-centos7-1.internal.sonarsource.com>2016-07-07 14:14:50 +0200
committerssjenka <ssjenka@ops-slave-centos7-1.internal.sonarsource.com>2016-07-07 14:14:50 +0200
commit6e837859e732707e6c1ce8040d90b2273af36ec9 (patch)
treeb5e64e7018ef0033e0568369ba7089c6b97fd335 /server
parentd788c4781bee2c122649b12b99ab8fc46f821c79 (diff)
parente6203dbc6e7e1d8516dc8243afdaf3a7c41270a6 (diff)
downloadsonarqube-6e837859e732707e6c1ce8040d90b2273af36ec9.tar.gz
sonarqube-6e837859e732707e6c1ce8040d90b2273af36ec9.zip
Automatic merge from branch-5.6
* origin/branch-5.6: SONAR-7869 api/measures/* formats correctly big MILLISEC metrics
Diffstat (limited to '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");
}