ValidationResultBuilderImpl implements ValidationResultBuilder { @Override public ValidationResultBuilder addErrorMessage(final String message) { addErrorMessage(message, null); return this; }  @Override ValidationResultBuilder addErrorMessage(final String message); @Override ValidationResultBuilder addErrorMessage(final String message, final Throwable t); @Override boolean isValid(); @Override boolean hasErrors(); @Override List<ErrorMessage> getErrorMessages(); @Override String toString();  }
@Test public void addErrorMessage() { tested.addErrorMessage(MSG_1); assertThat(tested.getErrorMessages(), hasSize(1)); ErrorMessage errorMessage = tested.getErrorMessages().get(0); assertThat(errorMessage.getMessage(), is(MSG_1)); assertThat(tested.isValid(), is(false)); assertThat(tested.hasErrors(), is(true)); }