use of org.sonarsource.sonarlint.core.client.api.TestClientInputFile in project sonarlint-core by SonarSource.
the class StandaloneAnalysisConfigurationTest method testToString.
@Test
public void testToString() throws Exception {
Map<String, String> props = new HashMap<>();
props.put("sonar.java.libraries", "foo bar");
final Path srcFile1 = temp.newFile().toPath();
final Path srcFile2 = temp.newFile().toPath();
final Path srcFile3 = temp.newFile().toPath();
ClientInputFile inputFile = new TestClientInputFile(temp.getRoot().toPath(), srcFile1, false, StandardCharsets.UTF_8, null);
ClientInputFile inputFileWithLanguage = new TestClientInputFile(temp.getRoot().toPath(), srcFile2, false, StandardCharsets.UTF_8, "java");
ClientInputFile testInputFile = new TestClientInputFile(temp.getRoot().toPath(), srcFile3, true, StandardCharsets.UTF_8, "php");
Path baseDir = temp.newFolder().toPath();
Path workDir = temp.newFolder().toPath();
StandaloneAnalysisConfiguration config = new StandaloneAnalysisConfiguration(baseDir, workDir, Arrays.asList(inputFile, inputFileWithLanguage, testInputFile), props);
assertThat(config.toString()).isEqualTo("[\n" + " baseDir: " + baseDir.toString() + "\n" + " workDir: " + workDir.toString() + "\n" + " extraProperties: {sonar.java.libraries=foo bar}\n" + " inputFiles: [\n" + " " + srcFile1.toString() + " (UTF-8)\n" + " " + srcFile2.toString() + " (UTF-8) [java]\n" + " " + srcFile3.toString() + " (UTF-8) [test] [php]\n" + " ]\n" + "]\n");
assertThat(config.baseDir()).isEqualTo(baseDir);
assertThat(config.workDir()).isEqualTo(workDir);
assertThat(config.inputFiles()).containsExactly(inputFile, inputFileWithLanguage, testInputFile);
assertThat(config.extraProperties()).containsExactly(entry("sonar.java.libraries", "foo bar"));
}
use of org.sonarsource.sonarlint.core.client.api.TestClientInputFile in project sonarlint-core by SonarSource.
the class ConnectedAnalysisConfigurationTest method testToString.
@Test
public void testToString() throws Exception {
Map<String, String> props = new HashMap<>();
props.put("sonar.java.libraries", "foo bar");
final Path srcFile1 = temp.newFile().toPath();
final Path srcFile2 = temp.newFile().toPath();
ClientInputFile inputFile = new TestClientInputFile(temp.getRoot().toPath(), srcFile1, false, StandardCharsets.UTF_8, null);
ClientInputFile testInputFile = new TestClientInputFile(temp.getRoot().toPath(), srcFile2, true, StandardCharsets.UTF_8, null);
Path baseDir = temp.newFolder().toPath();
Path workDir = temp.newFolder().toPath();
ConnectedAnalysisConfiguration config = new ConnectedAnalysisConfiguration("foo", baseDir, workDir, Arrays.asList(inputFile, testInputFile), props);
assertThat(config.toString()).isEqualTo("[\n" + " moduleKey: foo\n" + " baseDir: " + baseDir.toString() + "\n" + " workDir: " + workDir.toString() + "\n" + " extraProperties: {sonar.java.libraries=foo bar}\n" + " inputFiles: [\n" + " " + srcFile1.toString() + " (UTF-8)\n" + " " + srcFile2.toString() + " (UTF-8) [test]\n" + " ]\n" + "]\n");
assertThat(config.baseDir()).isEqualTo(baseDir);
assertThat(config.workDir()).isEqualTo(workDir);
assertThat(config.inputFiles()).containsExactly(inputFile, testInputFile);
assertThat(config.moduleKey()).isEqualTo("foo");
assertThat(config.extraProperties()).containsExactly(entry("sonar.java.libraries", "foo bar"));
config = new ConnectedAnalysisConfiguration(null, baseDir, workDir, Arrays.asList(inputFile, testInputFile), props);
assertThat(config.toString()).isEqualTo("[\n" + " baseDir: " + baseDir.toString() + "\n" + " workDir: " + workDir.toString() + "\n" + " extraProperties: {sonar.java.libraries=foo bar}\n" + " inputFiles: [\n" + " " + srcFile1.toString() + " (UTF-8)\n" + " " + srcFile2.toString() + " (UTF-8) [test]\n" + " ]\n" + "]\n");
}
Aggregations