use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class OverallCoverageSensorTest method testNoExecutionIfNoCoverageFile.
@Test
public void testNoExecutionIfNoCoverageFile() {
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo").setLanguage("xoo").setModuleBaseDir(baseDir.toPath()).build();
context.fileSystem().add(inputFile);
sensor.execute(context);
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class OverallCoverageSensorTest method testLineHitAndConditions.
@Test
public void testLineHitAndConditions() throws IOException {
File coverage = new File(baseDir, "src/foo.xoo.overallcoverage");
FileUtils.write(coverage, "1:3:4:2");
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo").setLanguage("xoo").setModuleBaseDir(baseDir.toPath()).setLines(10).build();
context.fileSystem().add(inputFile);
sensor.execute(context);
assertThat(context.lineHits("foo:src/foo.xoo", 1)).isEqualTo(3);
assertThat(context.conditions("foo:src/foo.xoo", 1)).isEqualTo(4);
assertThat(context.coveredConditions("foo:src/foo.xoo", 1)).isEqualTo(2);
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class UtCoverageSensorTest method testLineHitNoConditions.
@Test
public void testLineHitNoConditions() throws IOException {
File coverage = new File(baseDir, "src/foo.xoo.coverage");
FileUtils.write(coverage, "1:3\n\n#comment");
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo").setLanguage("xoo").setModuleBaseDir(baseDir.toPath()).setLines(10).build();
context.fileSystem().add(inputFile);
sensor.execute(context);
assertThat(context.lineHits("foo:src/foo.xoo", 1)).isEqualTo(3);
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class UtCoverageSensorTest method testLineHitAndConditions.
@Test
public void testLineHitAndConditions() throws IOException {
File coverage = new File(baseDir, "src/foo.xoo.coverage");
FileUtils.write(coverage, "1:3:4:2");
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo").setLanguage("xoo").setModuleBaseDir(baseDir.toPath()).setLines(10).build();
context.fileSystem().add(inputFile);
sensor.execute(context);
assertThat(context.lineHits("foo:src/foo.xoo", 1)).isEqualTo(3);
assertThat(context.conditions("foo:src/foo.xoo", 1)).isEqualTo(4);
assertThat(context.coveredConditions("foo:src/foo.xoo", 1)).isEqualTo(2);
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class UtCoverageSensorTest method testNoExecutionIfNoCoverageFile.
@Test
public void testNoExecutionIfNoCoverageFile() {
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo").setLanguage("xoo").setModuleBaseDir(baseDir.toPath()).build();
context.fileSystem().add(inputFile);
sensor.execute(context);
}
Aggregations