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 MeasureSensorTest method testNoExecutionIfNoMeasureFile.
@Test
public void testNoExecutionIfNoMeasureFile() {
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.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class OneQuickFixPerLineSensorTest method testRule.
@Test
public void testRule() throws IOException {
DefaultInputFile inputFile = new TestInputFileBuilder("foo", "src/Foo.xoo").setLanguage(Xoo.KEY).initMetadata("a\nb\nc\nd\ne\nf\ng\nh\ni\n").build();
SensorContextTester context = SensorContextTester.create(temp.newFolder());
context.fileSystem().add(inputFile);
sensor.execute(context);
// One issue per line
assertThat(context.allIssues()).hasSize(10);
for (Issue issue : context.allIssues()) {
assertThat(issue.isQuickFixAvailable()).isTrue();
}
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class SignificantCodeSensorTest method prepare.
@Before
public void prepare() throws IOException {
baseDir = temp.newFolder();
sensor = new SignificantCodeSensor();
context = SensorContextTester.create(baseDir);
inputFile = new TestInputFileBuilder("foo", baseDir, new File(baseDir, "src/foo.xoo")).setLanguage("xoo").setContents("some lines\nof code\nyet another line").build();
}
use of org.sonar.api.batch.fs.internal.TestInputFileBuilder in project sonarqube by SonarSource.
the class JavaCpdBlockIndexerSensorTest method prepare.
@Before
public void prepare() throws IOException {
MockitoAnnotations.initMocks(this);
File baseDir = temp.newFolder();
context = SensorContextTester.create(baseDir);
file = new TestInputFileBuilder("foo", "src/ManyStatements.java").setModuleBaseDir(baseDir.toPath()).setCharset(StandardCharsets.UTF_8).setLanguage("java").build();
context.fileSystem().add(file);
File ioFile = file.file();
FileUtils.copyURLToFile(this.getClass().getResource("ManyStatements.java"), ioFile);
}
Aggregations