use of org.sonar.api.batch.fs.InputFile in project sonar-go by SonarSource.
the class PluginApiUtilsTest method newRange_should_call_newRange_on_inputFile.
@Test
void newRange_should_call_newRange_on_inputFile() {
String value = "dummy value";
int line = 7;
int column = 13;
UastNode.Token token = new UastNode.Token(line, column, value);
InputFile inputFile = mock(InputFile.class);
PluginApiUtils.newRange(inputFile, token);
verify(inputFile).newRange(eq(line), eq(column - 1), eq(line), eq(column - 1 + value.length()));
}
use of org.sonar.api.batch.fs.InputFile in project sonarqube by SonarSource.
the class ItCoverageSensorTest method testNoExecutionIfNoCoverageFile.
@Test
public void testNoExecutionIfNoCoverageFile() {
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo").setLanguage("xoo").build();
context.fileSystem().add(inputFile);
sensor.execute(context);
}
use of org.sonar.api.batch.fs.InputFile in project sonarqube by SonarSource.
the class ItCoverageSensorTest method testLineHitAndConditions.
@Test
public void testLineHitAndConditions() throws IOException {
File coverage = new File(baseDir, "src/foo.xoo.itcoverage");
FileUtils.write(coverage, "1:3:4:2");
InputFile inputFile = new TestInputFileBuilder("foo", "src/foo.xoo").setModuleBaseDir(baseDir.toPath()).setLanguage("xoo").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.InputFile 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);
}
use of org.sonar.api.batch.fs.InputFile 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);
}
Aggregations