@Test
  public void shouldReturnSuccessfulResult() throws Exception {
    given(bindingResult.hasFieldErrors()).willReturn(false);

    ContactResult contactResult = contactService.processContactForm(contactForm(), bindingResult);

    assertThat(contactResult.isSuccess()).isTrue();
  }
  @Test
  public void shouldReturnFailureResult() throws Exception {
    givenThatFieldErrorsArePresent();

    ContactResult contactResult = contactService.processContactForm(contactForm(), bindingResult);

    assertThat(contactResult.isSuccess()).isFalse();
  }
  @Test
  public void shouldHandleMailServerExceptionAndReturnUnsuccessfulWithErrorMessage()
      throws Exception {
    doThrow(new RuntimeException()).when(contactMailService).sendEmail(any(ContactForm.class));

    ContactResult contactResult = contactService.processContactForm(contactForm(), bindingResult);

    assertThat(contactResult.isHasErrors()).isTrue();
    assertThat(contactResult.isSuccess()).isFalse();
    assertThat(contactResult.getErrors())
        .containsOnly("Uh oh! Something went wrong, please try again.");
  }