use of testutils.TestInputFileBuilder in project sonarlint-core by SonarSource.
the class SonarLintFileSystemTests method input_file_fails_if_too_many_results.
@Test
void input_file_fails_if_too_many_results() {
inputFileCache.doAdd(new TestInputFileBuilder("src/Bar.java").setLanguage(Language.JAVA).build());
inputFileCache.doAdd(new TestInputFileBuilder("src/Baz.java").setLanguage(Language.JAVA).build());
var thrown = assertThrows(IllegalArgumentException.class, () -> fs.inputFile(fs.predicates().all()));
assertThat(thrown).hasMessageStartingWith("expected one element");
}
use of testutils.TestInputFileBuilder in project sonarlint-core by SonarSource.
the class SensorOptimizerTests method should_optimize_on_type.
@Test
void should_optimize_on_type() {
var descriptor = new DefaultSensorDescriptor().onlyOnFileType(InputFile.Type.MAIN);
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
inputFileCache.doAdd(new TestInputFileBuilder("tests/FooTest.java").setType(InputFile.Type.TEST).build());
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
inputFileCache.doAdd(new TestInputFileBuilder("src/Foo.java").setType(InputFile.Type.MAIN).build());
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
Aggregations