JSONProfile extends ProfileDefinition { @Override public RulesProfile createProfile(ValidationMessages messages) { AnnotationBasedProfileBuilder annotationBasedProfileBuilder = new AnnotationBasedProfileBuilder(ruleFinder); return annotationBasedProfileBuilder.build( CheckList.REPOSITORY_KEY, SONARQUBE_WAY_PROFILE_NAME, JSONLanguage.KEY, CheckList.getChecks(), messages); } JSONProfile(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(); JSONProfile definition = new JSONProfile(universalRuleFinder()); RulesProfile profile = definition.createProfile(validation); assertThat(profile.getName()).isEqualTo(JSONProfile.SONARQUBE_WAY_PROFILE_NAME); assertThat(profile.getLanguage()).isEqualTo(JSONLanguage.KEY); assertThat(profile.getActiveRulesByRepository(CheckList.REPOSITORY_KEY)).hasSize(5); assertThat(validation.hasErrors()).isFalse(); }