@Test
public void testJson() throws Exception {

  AsyncHandler<Response<ByteString>> outerHandler = Middlewares.json().apply(
      rc -> Response.forPayload(TEST_STRUCT)
  );
  CompletionStage<Response<ByteString>> completionStage = outerHandler.invoke(
      RequestContexts.create(mock(Request.class),
          mock(Client.class),
          Collections.emptyMap(),
          System.nanoTime(),
          RequestMetadataImpl.create(Instant.EPOCH,
              Optional.empty(), Optional.empty())));
  assertThat(completionStage.toCompletableFuture().get().payload().orElseThrow().utf8(),
             is(
                 "{\"foo\":\"blah\"," +
                 "\"inner_object\":{" +
                 "\"field_name_convention\":\"bloh\"," +
                 "\"enum_field\":\"enum_value\"}}"
             ));
}