aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org/sonar/batch
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2016-05-17 11:42:45 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2016-05-17 14:38:49 +0200
commit69065a0dee5e6a4cd2ca414125edd421d4fe0a4c (patch)
treeca59af29aed6830b0ca258bfbd924e4b11b68fd2 /sonar-scanner-engine/src/test/java/org/sonar/batch
parent779a2484889df54ade1ca0236a0cb4b9605482e0 (diff)
downloadsonarqube-69065a0dee5e6a4cd2ca414125edd421d4fe0a4c.tar.gz
sonarqube-69065a0dee5e6a4cd2ca414125edd421d4fe0a4c.zip
Improve unit test coverage
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/batch')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java
index 0affd4dad8e..00e7ee34ab5 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/mediumtest/measures/MeasuresMediumTest.java
@@ -125,4 +125,30 @@ public class MeasuresMediumTest {
.contains(tuple("lines", 3), tuple("ncloc", 2));
}
+ @Test
+ public void lineMeasures() throws IOException {
+ File xooFile = new File(srcDir, "sample.xoo");
+ FileUtils.write(xooFile, "Sample xoo\n\n\ncontent");
+
+ File lineMeasures = new File(srcDir, "sample.xoo.linemeasures");
+ FileUtils.write(lineMeasures, "ncloc_data:1=1;2=0;4=1");
+
+ TaskResult result = tester.newTask()
+ .properties(ImmutableMap.<String, String>builder()
+ .put("sonar.task", "scan")
+ .put("sonar.projectBaseDir", baseDir.getAbsolutePath())
+ .put("sonar.projectKey", "com.foo.project")
+ .put("sonar.projectName", "Foo Project")
+ .put("sonar.projectVersion", "1.0-SNAPSHOT")
+ .put("sonar.projectDescription", "Description of Foo Project")
+ .put("sonar.sources", "src")
+ .build())
+ .start();
+
+ Map<String, List<Measure>> allMeasures = result.allMeasures();
+
+ assertThat(allMeasures.get("com.foo.project:src/sample.xoo")).extracting("metricKey", "intValue.value", "stringValue.value")
+ .containsExactly(tuple("lines", 4, ""), tuple("ncloc_data", 0, "1=1;4=1"));
+ }
+
}