use of org.sonar.scanner.mediumtest.LogOutputRecorder in project sonarqube by SonarSource.
the class FileSystemMediumTest method stop.
@After
public void stop() {
tester.stop();
logs = new LogOutputRecorder();
}
use of org.sonar.scanner.mediumtest.LogOutputRecorder in project sonarqube by SonarSource.
the class FileSystemMediumTest method createIssueOnAnyFile.
@Test
public void createIssueOnAnyFile() throws IOException {
LogOutputRecorder logs = new LogOutputRecorder();
ScannerMediumTester tester2 = ScannerMediumTester.builder().registerPlugin("xoo", new XooPlugin()).addDefaultQProfile("xoo", "Sonar Way").addRules(new XooRulesDefinition()).setLogOutput(logs).addActiveRule("xoo", "OneIssuePerUnknownFile", null, "OneIssuePerUnknownFile", "MAJOR", null, "xoo").build();
tester2.start();
builder = createBuilder();
File srcDir = new File(baseDir, "src");
srcDir.mkdir();
File xooFile = new File(srcDir, "sample.unknown");
FileUtils.write(xooFile, "Sample xoo\ncontent");
TaskResult result = tester2.newTask().properties(builder.put("sonar.sources", "src").build()).start();
assertThat(logs.getAllAsString()).contains("1 file indexed");
assertThat(logs.getAllAsString()).contains("'src/sample.unknown' indexed with language 'null'");
assertThat(logs.getAllAsString()).contains("'src/sample.unknown' generated metadata");
DefaultInputFile javaInputFile = (DefaultInputFile) result.inputFile("src/sample.unknown");
assertThat(result.getReportComponent(javaInputFile.key())).isNotNull();
tester2.stop();
}
Aggregations