HtmlSerializerMiddlewares { public static <T> Middleware<SyncHandler<T>, AsyncHandler<Response<ByteString>>> htmlSerializeSync( final String templateName) { Middleware<SyncHandler<T>, AsyncHandler<T>> syncToAsync = Middleware::syncToAsync; return syncToAsync.and(htmlSerialize(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 testHtmlSerializeSync() throws Exception { Response<ByteString> response = HtmlSerializerMiddlewares.htmlSerializeSync(TEST_TEMPLATE_FTL) .apply(rq -> ImmutableMap.of("match", "yo")) .invoke(null).toCompletableFuture().get(); checkContentTypeAndBody(response); }