For testing, you can create a new empty {@link Settings} component using {@link #Settings()} and thenpopulate it using all variant of {@code setProperty}.
If you want to test with default values of your properties taken into account there are two ways dependening on how you declare your properties.
{@literal @}Properties({ {@literal @}Property( key = "sonar.myProp", defaultValue = "A default value", name = "My property"), }) public class MyPlugin extends SonarPlugin { then you can use: new Settings(new PropertyDefinitions(MyPlugin.class)) public class MyPlugin extends SonarPlugin { public List getExtensions() { return Arrays.asList( PropertyDefinition.builder("sonar.myProp").name("My property").defaultValue("A default value").build() ); } } then you can use: new Settings(new PropertyDefinitions(new MyPlugin().getExtensions())) | |
| |
| |
| |
| |
| |
| |
| |
| |
| |