### Question:
SectionLevelValidator extends Validator { @Override public void validate(Section section) { int level = section.getLevel(); if (getInt("max_num") < level) { addLocalizedError(section.getJoinedHeaderContents(), level); } } SectionLevelValidator(); @Override void validate(Section section);  }### Answer:
@Test void testWithDeepSection() { Section section = new Section(7); List<ValidationError> errors = new ArrayList<>(); validator.setErrorList(errors); validator.validate(section); assertEquals(1, errors.size()); }
@Test void testWithShallowSection() { Section section = new Section(6); List<ValidationError> errors = new ArrayList<>(); validator.setErrorList(errors); validator.validate(section); assertEquals(0, errors.size()); }