From ab1f321e58cea13e35fd9986de416512c6e51c59 Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Mon, 13 Dec 2010 09:01:37 +0000 Subject: [PATCH] add IT to test data measures --- .../org/sonar/tests/integration/Struts139Test.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/integration/tests/src/it/java/org/sonar/tests/integration/Struts139Test.java b/tests/integration/tests/src/it/java/org/sonar/tests/integration/Struts139Test.java index c350bfc721f..37194027b61 100644 --- a/tests/integration/tests/src/it/java/org/sonar/tests/integration/Struts139Test.java +++ b/tests/integration/tests/src/it/java/org/sonar/tests/integration/Struts139Test.java @@ -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 trees = sonar.findAll(DependencyTreeQuery.createForProject(PROJECT_STRUTS)); -- 2.39.5