]> source.dussan.org Git - sonarqube.git/commitdiff
Fix violations reported on Nemo.
authorGodin <mandrikov@gmail.com>
Thu, 2 Dec 2010 23:56:05 +0000 (23:56 +0000)
committerGodin <mandrikov@gmail.com>
Thu, 2 Dec 2010 23:56:05 +0000 (23:56 +0000)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/metrics/UserManagedMetrics.java
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/metrics/UserManagedMetricsTest.java

index d6a2bfbbe3f1741debd456b2f11c5a1ce41a60dd..1f8d5a79a9e76487959180a11099103d408e7537 100644 (file)
@@ -26,11 +26,17 @@ import java.util.Arrays;
 import java.util.List;
 
 public class UserManagedMetrics implements Metrics {
+  private static final String DOMAIN = "Management";
+
   public List<Metric> getMetrics() {
     return Arrays.asList(
-        new Metric("burned_budget", "Burned budget", "The budget already used in the project", Metric.ValueType.FLOAT, 0, false, "Management", true),
-        new Metric("team_size", "Team size", "Size of the project team", Metric.ValueType.INT, 0, false, "Management", true),
-        new Metric("business_value", "Business value", "An indication on the value of the project for the business", Metric.ValueType.FLOAT, 1, true, "Management", true)
-    );
+        new Metric("burned_budget", "Burned budget", "The budget already used in the project", Metric.ValueType.FLOAT,
+            Metric.DIRECTION_NONE, false, DOMAIN)
+            .setUserManaged(true),
+        new Metric("team_size", "Team size", "Size of the project team", Metric.ValueType.INT, Metric.DIRECTION_NONE, false, DOMAIN)
+            .setUserManaged(true),
+        new Metric("business_value", "Business value", "An indication on the value of the project for the business",
+            Metric.ValueType.FLOAT, Metric.DIRECTION_BETTER, true, DOMAIN)
+            .setUserManaged(true));
   }
 }
index 72158fdbe88cf46f0993c396d39d01e4221e9c89..7ce01bb0ae1b052a0b50815f166edc3bd80d3e7e 100644 (file)
 package org.sonar.plugins.core.metrics;
 
 import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.is;
 import static org.junit.Assert.assertThat;
+
 import org.junit.Test;
+import org.sonar.api.measures.Metric;
+
+import java.util.List;
 
 public class UserManagedMetricsTest {
 
   @Test
   public void checkDefinitions() {
-    UserManagedMetrics metrics = new UserManagedMetrics();
-    assertThat(metrics.getMetrics().size(), greaterThan(2));
+    UserManagedMetrics userManagedMetrics = new UserManagedMetrics();
+    List<Metric> metrics = userManagedMetrics.getMetrics();
+    assertThat(metrics.size(), greaterThan(2));
+    for (Metric metric : metrics) {
+      assertThat(metric.getUserManaged(), is(true));
+      assertThat(metric.getDomain(), is("Management"));
+    }
   }
 }