@Test public void whenCreatingJavaCustomProfileThenGenerateProfileWithRules() { CustomProfile profile = new CustomProfile(); RulesProfile rulesProfile = profile.createProfile(null); List<ActiveRule> activeRules = rulesProfile.getActiveRulesByRepository(CheckList.REPOSITORY_KEY); Set<String> ruleKeys = getRuleKeys(activeRules); assertThat(ruleKeys, hasItem("GUJ0002")); assertThat(ruleKeys, hasItem("GUJ0002")); assertThat(ruleKeys.size(), is(2)); assertThat(rulesProfile.getLanguage(), is(Java.KEY)); assertThat(rulesProfile.getName(), is("Custom Java Profile")); }
@Override public RulesProfile createProfile(ValidationMessages messages) { URL resource = CustomRulesDefinition.class.getResource("/de/example/l10n/java/rules/custom/Custom_profile.json"); Profile jsonProfile = gson.fromJson(readResource(resource), Profile.class); RulesProfile profile = RulesProfile.create(jsonProfile.getName(), Java.KEY); for (String key : jsonProfile.getRuleKeys()) { Rule rule = Rule.create(CheckList.REPOSITORY_KEY, key); profile.activateRule(rule, null); } return profile; }
CustomProfile extends ProfileDefinition { @Override public RulesProfile createProfile(ValidationMessages messages) { URL resource = CustomRulesDefinition.class.getResource("/de/example/l10n/java/rules/custom/Custom_profile.json"); Profile jsonProfile = gson.fromJson(readResource(resource), Profile.class); RulesProfile profile = RulesProfile.create(jsonProfile.getName(), Java.KEY); for (String key : jsonProfile.getRuleKeys()) { Rule rule = Rule.create(CheckList.REPOSITORY_KEY, key); profile.activateRule(rule, null); } return profile; } }
CustomProfile extends ProfileDefinition { @Override public RulesProfile createProfile(ValidationMessages messages) { URL resource = CustomRulesDefinition.class.getResource("/de/example/l10n/java/rules/custom/Custom_profile.json"); Profile jsonProfile = gson.fromJson(readResource(resource), Profile.class); RulesProfile profile = RulesProfile.create(jsonProfile.getName(), Java.KEY); for (String key : jsonProfile.getRuleKeys()) { Rule rule = Rule.create(CheckList.REPOSITORY_KEY, key); profile.activateRule(rule, null); } return profile; }  }
CustomProfile extends ProfileDefinition { @Override public RulesProfile createProfile(ValidationMessages messages) { URL resource = CustomRulesDefinition.class.getResource("/de/example/l10n/java/rules/custom/Custom_profile.json"); Profile jsonProfile = gson.fromJson(readResource(resource), Profile.class); RulesProfile profile = RulesProfile.create(jsonProfile.getName(), Java.KEY); for (String key : jsonProfile.getRuleKeys()) { Rule rule = Rule.create(CheckList.REPOSITORY_KEY, key); profile.activateRule(rule, null); } return profile; }  @Override RulesProfile createProfile(ValidationMessages messages); }
CustomProfile extends ProfileDefinition { @Override public RulesProfile createProfile(ValidationMessages messages) { URL resource = CustomRulesDefinition.class.getResource("/de/example/l10n/java/rules/custom/Custom_profile.json"); Profile jsonProfile = gson.fromJson(readResource(resource), Profile.class); RulesProfile profile = RulesProfile.create(jsonProfile.getName(), Java.KEY); for (String key : jsonProfile.getRuleKeys()) { Rule rule = Rule.create(CheckList.REPOSITORY_KEY, key); profile.activateRule(rule, null); } return profile; }  @Override RulesProfile createProfile(ValidationMessages messages);  }