CssProfile extends ProfileDefinition { @Override public RulesProfile createProfile(ValidationMessages messages) { AnnotationBasedProfileBuilder annotationBasedProfileBuilder = new AnnotationBasedProfileBuilder(ruleFinder); return annotationBasedProfileBuilder.build( CheckList.CSS_REPOSITORY_KEY, SONARQUBE_WAY_PROFILE_NAME, CssLanguage.KEY, CheckList.getCssChecks(), messages); } CssProfile(RuleFinder ruleFinder); @Override RulesProfile createProfile(ValidationMessages messages); static final String SONARQUBE_WAY_PROFILE_NAME; }
@Test public void should_create_sonarqube_way_profile() { ValidationMessages validation = ValidationMessages.create(); CssProfile definition = new CssProfile(universalRuleFinder()); RulesProfile profile = definition.createProfile(validation); assertThat(profile.getName()).isEqualTo("SonarQube Way"); assertThat(profile.getLanguage()).isEqualTo("css"); assertThat(profile.getActiveRulesByRepository("css")).hasSize(72); assertThat(validation.hasErrors()).isFalse(); }