DroppedPropertiesSensor implements Sensor { @Override public void describe(SensorDescriptor descriptor) { descriptor .onlyOnLanguage("java") .onlyWhenConfiguration(configuration -> ALL_REMOVED_PROPERTIES.stream().anyMatch(configuration::hasKey)) .name("Removed properties sensor"); } DroppedPropertiesSensor(AnalysisWarnings analysisWarnings); @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context);  }
@Test void test_descriptor() throws Exception { DroppedPropertiesSensor sensor = new DroppedPropertiesSensor(w -> { }); DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor(); sensor.describe(descriptor); assertThat(descriptor.name()).isNotBlank(); Configuration emptyConfig = new MapSettings().asConfig(); assertThat(descriptor.configurationPredicate().test(emptyConfig)).isFalse(); Configuration removedProperty = new MapSettings().setProperty("sonar.jacoco.reportPaths", "/path").asConfig(); assertThat(descriptor.configurationPredicate().test(removedProperty)).isTrue(); }