@Override
  public Optional<AppInstallationToken> createAppInstallationToken(GithubAppConfiguration githubAppConfiguration, long installationId) {
    AppToken appToken = appSecurity.createAppToken(githubAppConfiguration.getId(), githubAppConfiguration.getPrivateKey());
    String endPoint = "/app/installations/" + installationId + "/access_tokens";
    return post(githubAppConfiguration.getApiEndpoint(), appToken, endPoint, GithubBinding.GsonInstallationToken.class)
      .map(GithubBinding.GsonInstallationToken::getToken)
      .filter(Objects::nonNull)
      .map(AppInstallationToken::new);
  }
@Test
  public void createAppInstallationToken_throws_IAE_if_application_token_cant_be_created() {
    mockNoApplicationJwtToken();

    assertThatThrownBy(() -> underTest.createAppInstallationToken(githubAppConfiguration, INSTALLATION_ID))
      .isInstanceOf(IllegalArgumentException.class);
  }