Search in sources :

Example 21 with SonarRuntime

use of org.sonar.api.SonarRuntime in project sonar-web by SonarSource.

the class HtmlSensorTest method test_descriptor_sonarqube_9_3.

@Test
public void test_descriptor_sonarqube_9_3() {
    final boolean[] called = { false };
    DefaultSensorDescriptor sensorDescriptor = new DefaultSensorDescriptor() {

        public SensorDescriptor processesFilesIndependently() {
            called[0] = true;
            return this;
        }
    };
    SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 3), SonarQubeSide.SCANNER, SonarEdition.COMMUNITY);
    new HtmlSensor(sonarRuntime, null, null, new CheckFactory(new DefaultActiveRules(Collections.emptyList()))).describe(sensorDescriptor);
    assertThat(sensorDescriptor.name()).isEqualTo("HTML");
    assertThat(sensorDescriptor.languages()).isEmpty();
    assertTrue(called[0]);
}
Also used : DefaultActiveRules(org.sonar.api.batch.rule.internal.DefaultActiveRules) DefaultSensorDescriptor(org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor) SonarRuntime(org.sonar.api.SonarRuntime) CheckFactory(org.sonar.api.batch.rule.CheckFactory) Test(org.junit.Test)

Aggregations

SonarRuntime (org.sonar.api.SonarRuntime)21 Test (org.junit.Test)18 Plugin (org.sonar.api.Plugin)7 CheckFactory (org.sonar.api.batch.rule.CheckFactory)4 DefaultActiveRules (org.sonar.api.batch.rule.internal.DefaultActiveRules)4 DefaultSensorDescriptor (org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor)3 MapSettings (org.sonar.api.config.internal.MapSettings)3 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 Test (org.junit.jupiter.api.Test)1 InputFile (org.sonar.api.batch.fs.InputFile)1 DefaultInputFile (org.sonar.api.batch.fs.internal.DefaultInputFile)1 ActiveRules (org.sonar.api.batch.rule.ActiveRules)1 NewActiveRule (org.sonar.api.batch.rule.internal.NewActiveRule)1 Settings (org.sonar.api.config.Settings)1 NoSonarFilter (org.sonar.api.issue.NoSonarFilter)1 FileLinesContext (org.sonar.api.measures.FileLinesContext)1 FileLinesContextFactory (org.sonar.api.measures.FileLinesContextFactory)1 RulesDefinition (org.sonar.api.server.rule.RulesDefinition)1 HtmlRulesDefinition (org.sonar.plugins.html.rules.HtmlRulesDefinition)1