HtmlSerializerMiddlewares { public static <T> ByteString serialize(final String templateName, T object) { StringWriter templateResults = new StringWriter(); try { final Template template = configuration.getTemplate(templateName); template.process(object, templateResults); } catch (Exception e) { throw Throwables.propagate(e); } return ByteString.encodeUtf8(templateResults.toString()); } 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 testException() throws Exception { expectedException.expect(RuntimeException.class); ImmutableMap<String, String> map = ImmutableMap.of("nomatch", "this"); HtmlSerializerMiddlewares.serialize(TEST_TEMPLATE_FTL, map); }