@Test void testProcessZeroLengthSentence() throws RedPenException { Configuration config = Configuration.builder() .addValidatorConfig(new ValidatorConfiguration("SpaceBeginningOfSentence")) .build(); List<Document> documents = new ArrayList<>(); documents.add(Document.builder() .addSection(1) .addParagraph() .addSentence(new Sentence("", 0)) .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) { String content = sentence.getContent(); if (!isFirstInLine(sentence) && content.length() > 0 && content.charAt(0) != ' ') { addLocalizedErrorWithPosition(sentence, 0, 1); } }
SpaceBeginningOfSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { String content = sentence.getContent(); if (!isFirstInLine(sentence) && content.length() > 0 && content.charAt(0) != ' ') { addLocalizedErrorWithPosition(sentence, 0, 1); } } }
SpaceBeginningOfSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { String content = sentence.getContent(); if (!isFirstInLine(sentence) && content.length() > 0 && content.charAt(0) != ' ') { addLocalizedErrorWithPosition(sentence, 0, 1); } }  }
SpaceBeginningOfSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { String content = sentence.getContent(); if (!isFirstInLine(sentence) && content.length() > 0 && content.charAt(0) != ' ') { addLocalizedErrorWithPosition(sentence, 0, 1); } }  @Override void validate(Sentence sentence); @Override void preValidate(Sentence sentence); }
SpaceBeginningOfSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { String content = sentence.getContent(); if (!isFirstInLine(sentence) && content.length() > 0 && content.charAt(0) != ' ') { addLocalizedErrorWithPosition(sentence, 0, 1); } }  @Override void validate(Sentence sentence); @Override void preValidate(Sentence sentence);  }