@Test
public void testUnathorizedMissingCredentialsApiError() throws Exception {

  when(auth.getToken(any())).thenReturn(Optional.empty());
  when(client.send(any()))
      .thenReturn(CompletableFuture.completedFuture(response(HTTP_FORBIDDEN)));
  try {
    styx.triggerWorkflowInstance("foo", "bar", "baz").toCompletableFuture().get();
    fail();
  } catch (ExecutionException e) {
    assertThat(e.getCause(), instanceOf(ApiErrorException.class));
    ApiErrorException apiErrorException = (ApiErrorException) e.getCause();
    assertThat(apiErrorException.isAuthenticated(), is(false));
  }
}