@Test public void test() { MyCustomJavaPropertiesRulesDefinition rulesDefinition = new MyCustomJavaPropertiesRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository repository = context.repository(REPOSITORY_KEY); assertThat(repository.name()).isEqualTo(REPOSITORY_NAME); assertThat(repository.language()).isEqualTo("jproperties"); assertThat(repository.rules()).hasSize(1); RulesDefinition.Rule customRule = repository.rule(RULE_KEY); assertThat(customRule).isNotNull(); assertThat(customRule.key()).isEqualTo(RULE_KEY); assertThat(customRule.name()).isEqualTo(RULE_NAME); RulesDefinition.Param param = repository.rules().get(0).params().get(0); assertThat(param.key()).isEqualTo("customParam"); assertThat(param.description()).isEqualTo("Custom parameter"); assertThat(param.defaultValue()).isEqualTo("Default value"); }
@Override public void define(Context context) { NewRepository repo = context.createRepository(repositoryKey(), "jproperties").setName(repositoryName()); new AnnotationBasedRulesDefinition(repo, "jproperties").addRuleClasses(false, ImmutableList.copyOf(checkClasses())); repo.done(); }
CustomJavaPropertiesRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repo = context.createRepository(repositoryKey(), "jproperties").setName(repositoryName()); new AnnotationBasedRulesDefinition(repo, "jproperties").addRuleClasses(false, ImmutableList.copyOf(checkClasses())); repo.done(); } }
CustomJavaPropertiesRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repo = context.createRepository(repositoryKey(), "jproperties").setName(repositoryName()); new AnnotationBasedRulesDefinition(repo, "jproperties").addRuleClasses(false, ImmutableList.copyOf(checkClasses())); repo.done(); }  }
CustomJavaPropertiesRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repo = context.createRepository(repositoryKey(), "jproperties").setName(repositoryName()); new AnnotationBasedRulesDefinition(repo, "jproperties").addRuleClasses(false, ImmutableList.copyOf(checkClasses())); repo.done(); }  @Override void define(Context context); abstract String repositoryName(); abstract String repositoryKey(); abstract Class[] checkClasses(); }
CustomJavaPropertiesRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repo = context.createRepository(repositoryKey(), "jproperties").setName(repositoryName()); new AnnotationBasedRulesDefinition(repo, "jproperties").addRuleClasses(false, ImmutableList.copyOf(checkClasses())); repo.done(); }  @Override void define(Context context); abstract String repositoryName(); abstract String repositoryKey(); abstract Class[] checkClasses();  }