@Test
public void createOrUpdateWorkflow() throws Exception {

  when(client.send(any(Request.class)))
      .thenReturn(CompletableFuture.completedFuture(response(HTTP_OK, WORKFLOW_1)));
  final CompletableFuture<Workflow> r = styx.createOrUpdateWorkflow("f[ ]o-cmp",
      WORKFLOW_CONFIGURATION_1).toCompletableFuture();
  verify(client, timeout(30_000)).send(requestCaptor.capture());
  assertThat(r.isDone(), is(true));
  final Request request = requestCaptor.getValue();
  final URI uri = URI.create(API_URL + "/workflows/f%5B%20%5Do-cmp");
  assertThat(request.url().toString(), is(uri.toString()));
  assertThat(Json.deserialize(bytesOfRequestBody(request), WorkflowConfiguration.class),
      is(WORKFLOW_CONFIGURATION_1));
  assertThat(request.method(), is("POST"));
}