### Question:
ValidationResult { @Override public String toString() { if (hasErrors()) { final StringBuilder result = new StringBuilder(); result.append("Validation failed due to:\n"); for (ValidationError error : getErrors()) { result.append(error); result.append("\n"); } return result.toString(); } else { return "OK"; } } ValidationResult(); List<ValidationError> getErrors(); void addError(String description, String messageCode); void addError(ValidationError validationError); void assertOk(); boolean hasErrors(); @Override String toString();  }### Answer:
@Test public void shouldReturnOkIfValidationHasNoErrors() throws Exception { assertThat(validationResultWithoutErrors.toString(), is("OK")); }
@Test public void shouldReturnErrorStringsIfValidationHasErrors() throws Exception { assertThat(validationResultWithErrors.toString(), startsWith("Validation failed due to:")); assertThat(validationResultWithErrors.toString(), containsString("Missing title element")); assertThat(validationResultWithErrors.toString(), containsString("Missing meta element")); }