@Test public void render() throws Exception { String templateVariable = "Hello Handlebars!"; Map<String, Object> model = new HashMap<>(); model.put("message", templateVariable); String expected = String.format("<h1>%s</h1>", templateVariable); String actual = new HandlebarsTemplateEngine().render(new ModelAndView(model, "hello.hbs")); assertEquals(expected, actual); }
@Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); try { Template template = handlebars.compile(viewName); return template.apply(modelAndView.getModel()); } catch (IOException e) { throw new RuntimeIOException(e); } }
HandlebarsTemplateEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); try { Template template = handlebars.compile(viewName); return template.apply(modelAndView.getModel()); } catch (IOException e) { throw new RuntimeIOException(e); } } }
HandlebarsTemplateEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); try { Template template = handlebars.compile(viewName); return template.apply(modelAndView.getModel()); } catch (IOException e) { throw new RuntimeIOException(e); } } HandlebarsTemplateEngine();  HandlebarsTemplateEngine(String resourceRoot); }
HandlebarsTemplateEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); try { Template template = handlebars.compile(viewName); return template.apply(modelAndView.getModel()); } catch (IOException e) { throw new RuntimeIOException(e); } } HandlebarsTemplateEngine();  HandlebarsTemplateEngine(String resourceRoot); @Override String render(ModelAndView modelAndView); }
HandlebarsTemplateEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); try { Template template = handlebars.compile(viewName); return template.apply(modelAndView.getModel()); } catch (IOException e) { throw new RuntimeIOException(e); } } HandlebarsTemplateEngine();  HandlebarsTemplateEngine(String resourceRoot); @Override String render(ModelAndView modelAndView);  }