public void describe(SensorDescriptor descriptor) {
descriptor
.name("Xoo Cpd Tokenizer Sensor")
- .requireProperty(ENABLE_PROP)
+ .onlyWhenConfiguration(conf -> conf.hasKey(ENABLE_PROP) || conf.hasKey(ENABLE_PROP + ".old"))
.onlyOnLanguages(Xoo.KEY);
}
@Parameters(name = "new api: {0}")
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][] {
- {true}, {false}
+ {true, false}, {true, true}, {false, false}
});
}
private ImmutableMap.Builder<String, String> builder;
private boolean useNewSensorApi;
+ private boolean useDeprecatedProperty;
- public CpdMediumTest(boolean useNewSensorApi) {
+ public CpdMediumTest(boolean useNewSensorApi, boolean useDeprecatedProperty) {
this.useNewSensorApi = useNewSensorApi;
+ this.useDeprecatedProperty = useDeprecatedProperty;
}
@Before
.put("sonar.projectVersion", "1.0-SNAPSHOT")
.put("sonar.projectDescription", "Description of Foo Project");
if (useNewSensorApi) {
- builder.put(CpdTokenizerSensor.ENABLE_PROP, "true");
+ builder.put(CpdTokenizerSensor.ENABLE_PROP + (useDeprecatedProperty ? ".deprecated" : ""), "true");
}
}