PmdSensor implements Sensor { @Override public void describe(SensorDescriptor descriptor) { descriptor .onlyWhenConfiguration(conf -> conf.hasKey(REPORT_PROPERTY_KEY)) .name("Import of PMD issues"); }  @Override void describe(SensorDescriptor descriptor); @Override void execute(SensorContext context); static final String REPORT_PROPERTY_KEY; static final String LINTER_KEY; static final ExternalRuleLoader RULE_LOADER; }
@Test void test_descriptor() { DefaultSensorDescriptor sensorDescriptor = new DefaultSensorDescriptor(); sensor.describe(sensorDescriptor); assertThat(sensorDescriptor.name()).isEqualTo("Import of PMD issues"); MapSettings settings = new MapSettings(); assertThat(sensorDescriptor.configurationPredicate().test(settings.asConfig())).isFalse(); settings.setProperty(PmdSensor.REPORT_PROPERTY_KEY, "report.xml"); assertThat(sensorDescriptor.configurationPredicate().test(settings.asConfig())).isTrue(); }