@Test public void test() { GherkinRulesDefinition rulesDefinition = new GherkinRulesDefinition(); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); RulesDefinition.Repository repository = context.repository("gherkin"); assertThat(repository.name()).isEqualTo("SonarQube"); assertThat(repository.language()).isEqualTo("gherkin"); assertThat(repository.rules()).hasSize(46); RulesDefinition.Rule lineLengthRule = repository.rule(TabCharacterCheck.class.getAnnotation(Rule.class).key()); assertThat(lineLengthRule).isNotNull(); assertThat(lineLengthRule.name()).isEqualTo(TabCharacterCheck.class.getAnnotation(Rule.class).name()); }
@Override public void define(Context context) { NewRepository repository = context .createRepository(REPOSITORY_KEY, GherkinLanguage.KEY) .setName(REPOSITORY_NAME); new AnnotationBasedRulesDefinition(repository, GherkinLanguage.KEY).addRuleClasses(false, getChecks()); repository.done(); }
GherkinRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repository = context .createRepository(REPOSITORY_KEY, GherkinLanguage.KEY) .setName(REPOSITORY_NAME); new AnnotationBasedRulesDefinition(repository, GherkinLanguage.KEY).addRuleClasses(false, getChecks()); repository.done(); } }
GherkinRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repository = context .createRepository(REPOSITORY_KEY, GherkinLanguage.KEY) .setName(REPOSITORY_NAME); new AnnotationBasedRulesDefinition(repository, GherkinLanguage.KEY).addRuleClasses(false, getChecks()); repository.done(); }  }
GherkinRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repository = context .createRepository(REPOSITORY_KEY, GherkinLanguage.KEY) .setName(REPOSITORY_NAME); new AnnotationBasedRulesDefinition(repository, GherkinLanguage.KEY).addRuleClasses(false, getChecks()); repository.done(); }  @Override void define(Context context); @SuppressWarnings("rawtypes") static Collection<Class> getChecks(); }
GherkinRulesDefinition implements RulesDefinition { @Override public void define(Context context) { NewRepository repository = context .createRepository(REPOSITORY_KEY, GherkinLanguage.KEY) .setName(REPOSITORY_NAME); new AnnotationBasedRulesDefinition(repository, GherkinLanguage.KEY).addRuleClasses(false, getChecks()); repository.done(); }  @Override void define(Context context); @SuppressWarnings("rawtypes") static Collection<Class> getChecks(); static final String REPOSITORY_KEY; }