@Test void testVoid() { List<ValidationError> errors = new ArrayList<>(); validator.setErrorList(errors); validator.validate(new Sentence("", 0)); assertEquals(0, errors.size()); }
@Override public void validate(Sentence sentence) { String content = sentence.getContent(); if (content.length() < 2) { return; } char lastCharacter = content.charAt(content.length() - 1); char secondCharacter = content.charAt(content.length() - 2); if (lastCharacter == period || lastCharacter == questionMark || lastCharacter == exclamationMark) { if (secondCharacter == rightSingleQuotation || secondCharacter == rightDoubleQuotation) { addLocalizedErrorWithPosition(sentence, content.length() - 2, content.length() - 1, String.valueOf(secondCharacter) + lastCharacter); } } }
EndOfSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { String content = sentence.getContent(); if (content.length() < 2) { return; } char lastCharacter = content.charAt(content.length() - 1); char secondCharacter = content.charAt(content.length() - 2); if (lastCharacter == period || lastCharacter == questionMark || lastCharacter == exclamationMark) { if (secondCharacter == rightSingleQuotation || secondCharacter == rightDoubleQuotation) { addLocalizedErrorWithPosition(sentence, content.length() - 2, content.length() - 1, String.valueOf(secondCharacter) + lastCharacter); } } } }
EndOfSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { String content = sentence.getContent(); if (content.length() < 2) { return; } char lastCharacter = content.charAt(content.length() - 1); char secondCharacter = content.charAt(content.length() - 2); if (lastCharacter == period || lastCharacter == questionMark || lastCharacter == exclamationMark) { if (secondCharacter == rightSingleQuotation || secondCharacter == rightDoubleQuotation) { addLocalizedErrorWithPosition(sentence, content.length() - 2, content.length() - 1, String.valueOf(secondCharacter) + lastCharacter); } } }  }
EndOfSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { String content = sentence.getContent(); if (content.length() < 2) { return; } char lastCharacter = content.charAt(content.length() - 1); char secondCharacter = content.charAt(content.length() - 2); if (lastCharacter == period || lastCharacter == questionMark || lastCharacter == exclamationMark) { if (secondCharacter == rightSingleQuotation || secondCharacter == rightDoubleQuotation) { addLocalizedErrorWithPosition(sentence, content.length() - 2, content.length() - 1, String.valueOf(secondCharacter) + lastCharacter); } } }  @Override List<String> getSupportedLanguages(); @Override void validate(Sentence sentence); }
EndOfSentenceValidator extends Validator { @Override public void validate(Sentence sentence) { String content = sentence.getContent(); if (content.length() < 2) { return; } char lastCharacter = content.charAt(content.length() - 1); char secondCharacter = content.charAt(content.length() - 2); if (lastCharacter == period || lastCharacter == questionMark || lastCharacter == exclamationMark) { if (secondCharacter == rightSingleQuotation || secondCharacter == rightDoubleQuotation) { addLocalizedErrorWithPosition(sentence, content.length() - 2, content.length() - 1, String.valueOf(secondCharacter) + lastCharacter); } } }  @Override List<String> getSupportedLanguages(); @Override void validate(Sentence sentence);  }