LessProfile extends ProfileDefinition { @Override public RulesProfile createProfile(ValidationMessages messages) { AnnotationBasedProfileBuilder annotationBasedProfileBuilder = new AnnotationBasedProfileBuilder(ruleFinder); return annotationBasedProfileBuilder.build( CheckList.LESS_REPOSITORY_KEY, SONARQUBE_WAY_PROFILE_NAME, LessLanguage.KEY, CheckList.getLessChecks(), messages); } LessProfile(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(); LessProfile definition = new LessProfile(universalRuleFinder()); RulesProfile profile = definition.createProfile(validation); assertThat(profile.getName()).isEqualTo("SonarQube Way"); assertThat(profile.getLanguage()).isEqualTo("less"); assertThat(profile.getActiveRulesByRepository("less")).hasSize(72); assertThat(validation.hasErrors()).isFalse(); }