### Question:
SentenceLengthValidator extends Validator { @Override public void validate(Sentence sentence) { int maxLength = getInt("max_len"); if (sentence.getContent().length() > maxLength) { addLocalizedError(sentence, sentence.getContent().length(), maxLength); } } SentenceLengthValidator(); @Override void validate(Sentence sentence);  }### Answer:
@Test void testWithLongSentence() { Sentence str = new Sentence("this is a very long long long long long long" + "long long long long long long sentence.", 0); List<ValidationError> errors = new ArrayList<>(); validator.setErrorList(errors); validator.validate(str); assertEquals(1, errors.size()); }
@Test void testWithShortSentence() { Sentence str = new Sentence("this is a sentence.", 0); List<ValidationError> errors = new ArrayList<>(); validator.setErrorList(errors); validator.validate(str); assertEquals(0, errors.size()); }
@Test void testWithZeroLengthSentence() { Sentence str = new Sentence("", 0); List<ValidationError> errors = new ArrayList<>(); validator.setErrorList(errors); validator.validate(str); assertEquals(0, errors.size()); }