ValidationResult { public void addWarning(ValidationWarning warning) { warnings.add(warning); } 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 addWarning() { ValidationWarning vw = mock(ValidationWarning.class); vr.addWarning(vw); assertFalse(vr.getWarnings().isEmpty()); assertEquals(vw, vr.getWarnings().get(0)); }