File xooFile = new File(srcDir, "sample.xoo");
File xooMeasureFile = new File(srcDir, "sample.xoo.measures");
FileUtils.write(xooFile, "Sample xoo\ncontent");
FileUtils.write(xooMeasureFile, "lines:20");
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();
assertThat(result.measures()).hasSize(1);
assertThat(result.measures()).contains(new DefaultMeasure<Integer>()
.forMetric(CoreMetrics.LINES)
.onFile(new DefaultInputFile("com.foo.project", "src/sample.xoo"))
.withValue(20));
}