@Test
  public void shouldFailToCreateIssueIfRemoteError() throws Exception {
    // Given that
    JiraSoapService jiraSoapService = mock(JiraSoapService.class);
    doThrow(RemoteException.class)
        .when(jiraSoapService)
        .createIssue(anyString(), any(RemoteIssue.class));

    // Verify
    thrown.expect(IllegalStateException.class);
    thrown.expectMessage("Impossible to create the issue on the JIRA server (my.jira)");

    jiraIssueCreator.sendRequest(jiraSoapService, "", null, "my.jira", "foo");
  }
  @Test
  public void shouldFailToCreateIssueIfCantAuthenticate() throws Exception {
    // Given that
    JiraSoapService jiraSoapService = mock(JiraSoapService.class);
    doThrow(RemoteAuthenticationException.class)
        .when(jiraSoapService)
        .createIssue(anyString(), any(RemoteIssue.class));

    // Verify
    thrown.expect(IllegalStateException.class);
    thrown.expectMessage(
        "Impossible to connect to the JIRA server (my.jira) because of invalid credentials for user foo");

    jiraIssueCreator.sendRequest(jiraSoapService, "", null, "my.jira", "foo");
  }