]> source.dussan.org Git - sonarqube.git/commitdiff
add IT to test data measures
authorsimonbrandhof <simon.brandhof@gmail.com>
Mon, 13 Dec 2010 09:01:37 +0000 (09:01 +0000)
committersimonbrandhof <simon.brandhof@gmail.com>
Mon, 13 Dec 2010 09:01:37 +0000 (09:01 +0000)
tests/integration/tests/src/it/java/org/sonar/tests/integration/Struts139Test.java

index c350bfc721f3694203128b0e685fd137563f000e..37194027b61b0beaffaebf7997b58dfcb9627e2a 100644 (file)
@@ -28,6 +28,7 @@ import org.sonar.wsclient.services.*;
 import java.util.Date;
 import java.util.List;
 
+import static junit.framework.Assert.assertTrue;
 import static org.hamcrest.core.Is.is;
 import static org.hamcrest.Matchers.nullValue;
 import static org.hamcrest.number.OrderingComparisons.greaterThan;
@@ -144,7 +145,7 @@ public class Struts139Test {
   }
 
   @Test
-  public void design() {
+  public void designMeaures() {
     assertThat(getCoreModuleMeasure("package_cycles").getIntValue(), greaterThan(10));
     assertThat(getCoreModuleMeasure("package_cycles").getIntValue(), lessThan(50));
     
@@ -157,6 +158,15 @@ public class Struts139Test {
     assertThat(sonar.find(ResourceQuery.createForMetrics(PROJECT_STRUTS, "dit", "noc")).getMeasures().size(), is(0));
   }
 
+  @Test
+  public void shouldGetDetailsOfCoverageHits() {
+    Resource resource = sonar.find(ResourceQuery.createForMetrics("org.apache.struts:struts-core:org.apache.struts.action.ActionForward", CoreMetrics.COVERAGE_LINE_HITS_DATA_KEY));
+    Measure coverageData = resource.getMeasure(CoreMetrics.COVERAGE_LINE_HITS_DATA_KEY);
+    assertNotNull(coverageData);
+    assertThat(coverageData.getData().length(), greaterThan(10));
+    assertTrue(coverageData.getData().matches("(\\d+=\\d+;{0,1})+"));
+  }
+
   @Test
   public void dependencyTree() {
     List<DependencyTree> trees = sonar.findAll(DependencyTreeQuery.createForProject(PROJECT_STRUTS));