use of org.sonarsource.sonarlint.core.analysis.sonarapi.MapSettings in project sonarlint-core by SonarSource.
the class SensorOptimizerTests method prepare.
@BeforeEach
void prepare() throws Exception {
fs = new SonarLintFileSystem(mock(AnalysisConfiguration.class), inputFileCache);
settings = new MapSettings(Map.of());
optimizer = new SensorOptimizer(fs, mock(ActiveRules.class), settings.asConfig());
}
use of org.sonarsource.sonarlint.core.analysis.sonarapi.MapSettings in project sonarlint-core by SonarSource.
the class SensorOptimizerTests method should_optimize_on_settings.
@Test
void should_optimize_on_settings() {
var descriptor = new DefaultSensorDescriptor().onlyWhenConfiguration(c -> c.hasKey("sonar.foo.reportPath"));
assertThat(optimizer.shouldExecute(descriptor)).isFalse();
settings = new MapSettings(Map.of("sonar.foo.reportPath", "foo"));
optimizer = new SensorOptimizer(fs, mock(ActiveRules.class), settings.asConfig());
assertThat(optimizer.shouldExecute(descriptor)).isTrue();
}
use of org.sonarsource.sonarlint.core.analysis.sonarapi.MapSettings in project sonarlint-core by SonarSource.
the class DefaultServerTests method coverageUnusedMethods.
@Test
void coverageUnusedMethods() {
var runtime = mock(SonarRuntime.class);
when(runtime.getApiVersion()).thenReturn(Version.create(2, 2));
var metadata = new DefaultServer(new MapSettings(Map.of()), runtime);
assertThat(metadata.getStartedAt()).isNull();
assertThat(metadata.getContextPath()).isNull();
assertThat(metadata.isSecured()).isFalse();
assertThat(metadata.getPublicRootUrl()).isNull();
}
Aggregations