ValidationResult { public void addError(ValidationError error) { errors.add(error); } ValidationResult(); List<ValidationError> getErrors(); void addError(ValidationError error); void addError(String resourceKey); List<RulesValidationError> getErrorKeys(); void addError(RulesValidationError errorKey); List<ValidationWarning> getWarnings(); void addWarning(ValidationWarning warning); void addWarning(String resourceKey); void add(ValidationResult result); boolean hasErrors(); boolean hasErrorKeys(); boolean hasWarnings(); boolean isSuccessful();  }
@Test public void addError() { ValidationError ve = mock(ValidationError.class); vr.addError(ve); assertFalse(vr.getErrors().isEmpty()); assertEquals(ve, vr.getErrors().get(0)); }