@Test void testInvalid() { Document document = Document.builder() .addSection(4) .addSectionHeader("Abstract") .build(); List<ValidationError> errors = new ArrayList<>(); validator.setErrorList(errors); validator.validate(document.getSection(0)); assertEquals(1, errors.size()); }
@Override public void validate(Section section) { if (0 == section.getLevel() || section.getLevel() >= sectionLevelLimit) { return; } Sentence header = section.getJoinedHeaderContents(); if (section.getNumberOfParagraphs() == 0) { addLocalizedError(header, header.getContent()); } else { for (Paragraph p : section.getParagraphs()) { if (p.getNumberOfSentences() == 0) { addLocalizedError(header, header.getContent()); break; } } } }
VoidSectionValidator extends Validator { @Override public void validate(Section section) { if (0 == section.getLevel() || section.getLevel() >= sectionLevelLimit) { return; } Sentence header = section.getJoinedHeaderContents(); if (section.getNumberOfParagraphs() == 0) { addLocalizedError(header, header.getContent()); } else { for (Paragraph p : section.getParagraphs()) { if (p.getNumberOfSentences() == 0) { addLocalizedError(header, header.getContent()); break; } } } } }
VoidSectionValidator extends Validator { @Override public void validate(Section section) { if (0 == section.getLevel() || section.getLevel() >= sectionLevelLimit) { return; } Sentence header = section.getJoinedHeaderContents(); if (section.getNumberOfParagraphs() == 0) { addLocalizedError(header, header.getContent()); } else { for (Paragraph p : section.getParagraphs()) { if (p.getNumberOfSentences() == 0) { addLocalizedError(header, header.getContent()); break; } } } }  }
VoidSectionValidator extends Validator { @Override public void validate(Section section) { if (0 == section.getLevel() || section.getLevel() >= sectionLevelLimit) { return; } Sentence header = section.getJoinedHeaderContents(); if (section.getNumberOfParagraphs() == 0) { addLocalizedError(header, header.getContent()); } else { for (Paragraph p : section.getParagraphs()) { if (p.getNumberOfSentences() == 0) { addLocalizedError(header, header.getContent()); break; } } } }  @Override void validate(Section section); }
VoidSectionValidator extends Validator { @Override public void validate(Section section) { if (0 == section.getLevel() || section.getLevel() >= sectionLevelLimit) { return; } Sentence header = section.getJoinedHeaderContents(); if (section.getNumberOfParagraphs() == 0) { addLocalizedError(header, header.getContent()); } else { for (Paragraph p : section.getParagraphs()) { if (p.getNumberOfSentences() == 0) { addLocalizedError(header, header.getContent()); break; } } } }  @Override void validate(Section section);  }