@Test void testValid() throws Exception { Section section = new Section(0, "header"); section.appendListBlock(); section.appendListElement(1, Arrays.asList(new Sentence("item1", 1))); section.appendListElement(2, Arrays.asList(new Sentence("item2", 1))); section.appendListElement(3, Arrays.asList(new Sentence("item3", 1))); List<ValidationError> errors = new ArrayList<>(); validator.setErrorList(errors); validator.validate(section); assertEquals(0, errors.size()); }
@Override public void validate(Section section) { for (ListBlock listBlock : section.getListBlocks()) { for (ListElement listElement : listBlock.getListElements()) { final int maxLevel = getInt("max_level"); if (listElement.getLevel() > maxLevel) { addLocalizedError(listElement.getSentence(0), maxLevel); } } } }
ListLevelValidator extends Validator { @Override public void validate(Section section) { for (ListBlock listBlock : section.getListBlocks()) { for (ListElement listElement : listBlock.getListElements()) { final int maxLevel = getInt("max_level"); if (listElement.getLevel() > maxLevel) { addLocalizedError(listElement.getSentence(0), maxLevel); } } } } }
ListLevelValidator extends Validator { @Override public void validate(Section section) { for (ListBlock listBlock : section.getListBlocks()) { for (ListElement listElement : listBlock.getListElements()) { final int maxLevel = getInt("max_level"); if (listElement.getLevel() > maxLevel) { addLocalizedError(listElement.getSentence(0), maxLevel); } } } } ListLevelValidator(); }
ListLevelValidator extends Validator { @Override public void validate(Section section) { for (ListBlock listBlock : section.getListBlocks()) { for (ListElement listElement : listBlock.getListElements()) { final int maxLevel = getInt("max_level"); if (listElement.getLevel() > maxLevel) { addLocalizedError(listElement.getSentence(0), maxLevel); } } } } ListLevelValidator(); @Override void validate(Section section); }
ListLevelValidator extends Validator { @Override public void validate(Section section) { for (ListBlock listBlock : section.getListBlocks()) { for (ListElement listElement : listBlock.getListElements()) { final int maxLevel = getInt("max_level"); if (listElement.getLevel() > maxLevel) { addLocalizedError(listElement.getSentence(0), maxLevel); } } } } ListLevelValidator(); @Override void validate(Section section);  }