@Test void testSimilarButNotSame() throws Exception { Configuration config = Configuration.builder() .addValidatorConfig(new ValidatorConfiguration("SuccessiveSentence")) .build(); List<Document> documents = new ArrayList<>(); documents.add( Document.builder() .addSection(1) .addParagraph() .addSentence(new Sentence("This is a pen.", 1)) .addSentence(new Sentence("That is another pen.", 2)) .build()); RedPen redPen = new RedPen(config); Map<Document, List<ValidationError>> errors = redPen.validate(documents); assertEquals(0, errors.get(documents.get(0)).size()); }
@Override public void validate(Sentence sentence) { if (isSame(sentence, prevSentence)) { addLocalizedError(sentence, prevSentence.getContent(), sentence.getContent()); } prevSentence = sentence; }
SuccessiveSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { if (isSame(sentence, prevSentence)) { addLocalizedError(sentence, prevSentence.getContent(), sentence.getContent()); } prevSentence = sentence; } }
SuccessiveSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { if (isSame(sentence, prevSentence)) { addLocalizedError(sentence, prevSentence.getContent(), sentence.getContent()); } prevSentence = sentence; } SuccessiveSentenceValidator(); }
SuccessiveSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { if (isSame(sentence, prevSentence)) { addLocalizedError(sentence, prevSentence.getContent(), sentence.getContent()); } prevSentence = sentence; } SuccessiveSentenceValidator(); @Override void validate(Sentence sentence); }
SuccessiveSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { if (isSame(sentence, prevSentence)) { addLocalizedError(sentence, prevSentence.getContent(), sentence.getContent()); } prevSentence = sentence; } SuccessiveSentenceValidator(); @Override void validate(Sentence sentence);  }