]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6939 decrease maximum nb of decimal digits to 5
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 14 Dec 2015 08:41:43 +0000 (09:41 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 14 Dec 2015 08:41:43 +0000 (09:41 +0100)
More than 5 breaks the support of big numbers

sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
sonar-plugin-api/src/test/java/org/sonar/api/measures/MetricTest.java

index 8fdb94f44a6fe1379ac179aaaba7d5ff0721d861..4783b6e178eb496a0d65e72193bc1e0401dad0bc 100644 (file)
@@ -51,7 +51,7 @@ public class Metric<G extends Serializable> implements Serializable, org.sonar.a
    * The maximum supported value of scale for decimal metrics
    * @since 5.3
    */
-  public static final int MAX_DECIMAL_SCALE = 20;
+  public static final int MAX_DECIMAL_SCALE = 5;
 
   /**
    * A metric bigger value means a degradation
index 0a088f53d3a1ca3e5d14b3ccc0421567e40e6313..e5765d51961b818949145bbfa65abad0ce81f704 100644 (file)
@@ -84,10 +84,10 @@ public class MetricTest {
   @Test
   public void fail_if_decimal_scale_is_greater_than_max_supported_value() {
     expectedException.expect(IllegalArgumentException.class);
-    expectedException.expectMessage("Scale of decimal metric [foo] must be less than or equal 20: 21");
+    expectedException.expectMessage("Scale of decimal metric [foo] must be less than or equal 5: 6");
 
     new Metric.Builder("foo", "Foo", Metric.ValueType.FLOAT)
-      .setDecimalScale(Metric.MAX_DECIMAL_SCALE + 1)
+      .setDecimalScale(6)
       .create();
   }