]> source.dussan.org Git - sonarqube.git/commitdiff
Add IT for SONAR-2041
authorGodin <mandrikov@gmail.com>
Fri, 10 Dec 2010 18:24:52 +0000 (18:24 +0000)
committerGodin <mandrikov@gmail.com>
Fri, 10 Dec 2010 18:24:52 +0000 (18:24 +0000)
tests/integration/tests/src/it/java/org/sonar/tests/integration/Struts139Test.java

index 25120ad51f69e76f8034488ed833a8508d6783b5..c350bfc721f3694203128b0e685fd137563f000e 100644 (file)
@@ -29,6 +29,7 @@ import java.util.Date;
 import java.util.List;
 
 import static org.hamcrest.core.Is.is;
+import static org.hamcrest.Matchers.nullValue;
 import static org.hamcrest.number.OrderingComparisons.greaterThan;
 import static org.hamcrest.number.IsCloseTo.closeTo;
 import static org.hamcrest.number.OrderingComparisons.greaterThanOrEqualTo;
@@ -178,6 +179,17 @@ public class Struts139Test {
     assertThat(version.getCategory(), is("Version"));
   }
 
+  /**
+   * See http://jira.codehaus.org/browse/SONAR-2041
+   */
+  @Test
+  public void unknownMetric() {
+    assertThat(getProjectMeasure("notfound"), nullValue());
+    assertThat(getCoreModuleMeasure("notfound"), nullValue());
+    assertThat(getPackageMeasure("notfound"), nullValue());
+    assertThat(getFileMeasure("notfound"), nullValue());
+  }
+
   private Measure getFileMeasure(String metricKey) {
     return sonar.find(ResourceQuery.createForMetrics(FILE_ACTION, metricKey)).getMeasure(metricKey);
   }
@@ -189,7 +201,7 @@ public class Struts139Test {
   private Measure getProjectMeasure(String metricKey) {
     return sonar.find(ResourceQuery.createForMetrics(PROJECT_STRUTS, metricKey)).getMeasure(metricKey);
   }
-  
+
   private Measure getPackageMeasure(String metricKey) {
     return sonar.find(ResourceQuery.createForMetrics(PACKAGE_ACTION, metricKey)).getMeasure(metricKey);
   }