@Test void testInvalid() throws RedPenException { Configuration config = Configuration.builder("ja") .addValidatorConfig(new ValidatorConfiguration("JapaneseJoyoKanji")) .build(); List<Document> documents = new ArrayList<>();documents.add( Document.builder(new NeologdJapaneseTokenizer()) .addSection(1) .addParagraph() .addSentence(new Sentence("惡や學などは常用漢字ではありません。", 1)) .build()); RedPen redPen = new RedPen(config); List<ValidationError> errors = redPen.validate(documents).get(documents.get(0)); assertEquals(2, errors.size()); assertEquals("JapaneseJoyoKanji", errors.get(0).getValidatorName()); assertEquals("JapaneseJoyoKanji", errors.get(1).getValidatorName()); }
@Override public void validate(Sentence sentence) { Set<String> customSkipList = getSet("list"); final Matcher m = nonJoyoKanji.matcher(sentence.getContent()); while (m.find()) { String kanji = m.group(); if (customSkipList == null || !customSkipList.contains(kanji)) { addLocalizedError(sentence, kanji); } } }
JapaneseJoyoKanjiValidator extends Validator { @Override public void validate(Sentence sentence) { Set<String> customSkipList = getSet("list"); final Matcher m = nonJoyoKanji.matcher(sentence.getContent()); while (m.find()) { String kanji = m.group(); if (customSkipList == null || !customSkipList.contains(kanji)) { addLocalizedError(sentence, kanji); } } } }
JapaneseJoyoKanjiValidator extends Validator { @Override public void validate(Sentence sentence) { Set<String> customSkipList = getSet("list"); final Matcher m = nonJoyoKanji.matcher(sentence.getContent()); while (m.find()) { String kanji = m.group(); if (customSkipList == null || !customSkipList.contains(kanji)) { addLocalizedError(sentence, kanji); } } }  }
JapaneseJoyoKanjiValidator extends Validator { @Override public void validate(Sentence sentence) { Set<String> customSkipList = getSet("list"); final Matcher m = nonJoyoKanji.matcher(sentence.getContent()); while (m.find()) { String kanji = m.group(); if (customSkipList == null || !customSkipList.contains(kanji)) { addLocalizedError(sentence, kanji); } } }  @Override List<String> getSupportedLanguages(); @Override void validate(Sentence sentence); }
JapaneseJoyoKanjiValidator extends Validator { @Override public void validate(Sentence sentence) { Set<String> customSkipList = getSet("list"); final Matcher m = nonJoyoKanji.matcher(sentence.getContent()); while (m.find()) { String kanji = m.group(); if (customSkipList == null || !customSkipList.contains(kanji)) { addLocalizedError(sentence, kanji); } } }  @Override List<String> getSupportedLanguages(); @Override void validate(Sentence sentence);  }