@Test void testSectionValidatorWithSimpleDocument() throws RedPenException { List<Document> documents = new ArrayList<>(); documents.add(Document.builder() .setFileName("tested file") .addSection(0) .addSectionHeader("foobar") .addParagraph() .addSentence(new Sentence("it is a piece of a cake.", 1)) .addSentence(new Sentence("that is also a piece of a cake.", 2)) .build()); RedPen redPen = getRedPenWithSectionValidator(); List<ValidationError> errors = redPen.validate(documents).get(documents.get(0)); assertEquals(1, errors.size()); for (ValidationError error : errors) { assertEquals(error.getValidatorName(), "SectionLength"); assertTrue(error.getMessage().contains("The number of characters in the section (55) exceeds the maximum of 5")); } }
public Map<Document, List<ValidationError>> validate(List<Document> documents) { return validate(documents, "error"); }
RedPen { public Map<Document, List<ValidationError>> validate(List<Document> documents) { return validate(documents, "error"); } }
RedPen { public Map<Document, List<ValidationError>> validate(List<Document> documents) { return validate(documents, "error"); } RedPen(File configFile);  RedPen(String configPath);  RedPen(Configuration configuration); }
RedPen { public Map<Document, List<ValidationError>> validate(List<Document> documents) { return validate(documents, "error"); } RedPen(File configFile);  RedPen(String configPath);  RedPen(Configuration configuration); Document parse(DocumentParser parser, InputStream InputStream); Document parse(DocumentParser parser, String content); List<Document> parse(DocumentParser parser, File[] files); Map<Document, List<ValidationError>> validate(List<Document> documents); Map<Document, List<ValidationError>> validate(List<Document> documents, String threshold); List<ValidationError> validate(Document document); List<Validator> getValidators(); Configuration getConfiguration(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
RedPen { public Map<Document, List<ValidationError>> validate(List<Document> documents) { return validate(documents, "error"); } RedPen(File configFile);  RedPen(String configPath);  RedPen(Configuration configuration); Document parse(DocumentParser parser, InputStream InputStream); Document parse(DocumentParser parser, String content); List<Document> parse(DocumentParser parser, File[] files); Map<Document, List<ValidationError>> validate(List<Document> documents); Map<Document, List<ValidationError>> validate(List<Document> documents, String threshold); List<ValidationError> validate(Document document); List<Validator> getValidators(); Configuration getConfiguration(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final String VERSION; }