HtmlSerializerMiddlewares { public static <T> Middleware<SyncHandler<Response<T>>, AsyncHandler<Response<ByteString>>> htmlSerializeResponseSync( final String templateName) { Middleware<SyncHandler<Response<T>>, AsyncHandler<Response<T>>> syncToAsync = Middleware::syncToAsync; return syncToAsync.and(htmlSerializeResponse(templateName)); } private  HtmlSerializerMiddlewares(); static ByteString serialize(final String templateName, T object); static Middleware<AsyncHandler<T>, AsyncHandler<Response<ByteString>>> htmlSerialize(
      final String templateName); static Middleware<AsyncHandler<Response<T>>, AsyncHandler<Response<ByteString>>> htmlSerializeResponse(final String templateName); static Middleware<SyncHandler<T>, AsyncHandler<Response<ByteString>>> htmlSerializeSync(
      final String templateName); static Middleware<SyncHandler<Response<T>>, AsyncHandler<Response<ByteString>>> htmlSerializeResponseSync(
      final String templateName);  }
@Test public void testHtmlSerializeResponseSync() throws Exception { Response<ByteString> response = HtmlSerializerMiddlewares.htmlSerializeResponseSync(TEST_TEMPLATE_FTL) .apply(rq -> Response.forPayload(ImmutableMap.of("match", "yo"))) .invoke(null).toCompletableFuture().get(); checkContentTypeAndBody(response); }