@Test
public void testTriggerWorkflowInstanceWithTriggerParametersAllowFuture() throws IOException {

  final TriggerParameters triggerParameters = TriggerParameters.builder()
      .env("FOO", "BAR", "BAR", "FOO")
      .build();
  final TriggerRequest triggerRequest =
      TriggerRequest.of(WORKFLOW_1.id(), "2017-01-01", triggerParameters);
  when(client.send(any(Request.class)))
      .thenReturn(CompletableFuture.completedFuture(response(HTTP_OK)));
  final CompletableFuture<Void> r =
      styx.triggerWorkflowInstance(WORKFLOW_1.componentId(), WORKFLOW_1.workflowId(),
          "2017-01-01", triggerParameters, true).toCompletableFuture();
  verify(client, timeout(30_000)).send(requestCaptor.capture());
  assertThat(r.isDone(), is(true));
  final Request request = requestCaptor.getValue();
  assertThat(request.url().toString(), is(API_URL + "/scheduler/trigger?allowFuture=true"));
  assertThat(request.method(), is("POST"));
  assertThat(Json.deserialize(bytesOfRequestBody(request), TriggerRequest.class),
      equalTo(triggerRequest));
}