@Test
public void testUsesClientRequestIdOnNoResponseRequestId() throws Exception {

  when(client.send(requestCaptor.capture()))
      .thenReturn(CompletableFuture.completedFuture(response(HTTP_INTERNAL_ERROR, Collections.emptyList())));
  try {
    styx.workflows().toCompletableFuture().get();
    fail();
  } catch (ExecutionException e) {
    assertThat(e.getCause(), instanceOf(ApiErrorException.class));
    final ApiErrorException apiError = (ApiErrorException) e.getCause();
    final Request request = requestCaptor.getValue();
    assertThat(apiError.getRequestId(), is(request.header("X-Request-Id")));
  }
}