@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()); }
@Override public void validate(Sentence sentence) { int maxLength = getInt("max_len"); if (sentence.getContent().length() > maxLength) { addLocalizedError(sentence, sentence.getContent().length(), maxLength); } }
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 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(); }
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); }
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);  }