private void setUpRule(Language language) throws IOException {
   langTool = new JLanguageTool(language);
   for (Rule rule : langTool.getAllRules()) {
     langTool.disableRule(rule.getId());
   }
   GenericUnpairedBracketsRule rule =
       new GenericUnpairedBracketsRule(TestTools.getEnglishMessages(), language);
   langTool.addRule(rule);
 }
示例#2
0
 private JLanguageTool getLanguageToolWithOneRule(Language lang, PatternRule patternRule)
     throws IOException {
   final JLanguageTool langTool = new JLanguageTool(lang);
   for (Rule rule : langTool.getAllActiveRules()) {
     langTool.disableRule(rule.getId());
   }
   langTool.addRule(patternRule);
   return langTool;
 }