@Test public void test_render() throws Exception { String templateVariable = "Hello Mustache!"; Map<String, Object> model = new HashMap<>(); model.put("message", templateVariable); String expected = String.format("<h1>%s</h1>", templateVariable); String actual = new MustacheTemplateEngine().render(new ModelAndView(model, "hello.mustache")); assertEquals(expected, actual); }
@Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); Mustache mustache = mustacheFactory.compile(viewName); StringWriter stringWriter = new StringWriter(); try { mustache.execute(stringWriter, modelAndView.getModel()).close(); } catch (IOException e) { throw new RuntimeIOException(e); } return stringWriter.toString(); }
MustacheTemplateEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); Mustache mustache = mustacheFactory.compile(viewName); StringWriter stringWriter = new StringWriter(); try { mustache.execute(stringWriter, modelAndView.getModel()).close(); } catch (IOException e) { throw new RuntimeIOException(e); } return stringWriter.toString(); } }
MustacheTemplateEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); Mustache mustache = mustacheFactory.compile(viewName); StringWriter stringWriter = new StringWriter(); try { mustache.execute(stringWriter, modelAndView.getModel()).close(); } catch (IOException e) { throw new RuntimeIOException(e); } return stringWriter.toString(); } MustacheTemplateEngine();  MustacheTemplateEngine(String resourceRoot);  MustacheTemplateEngine(MustacheFactory mustacheFactory); }
MustacheTemplateEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); Mustache mustache = mustacheFactory.compile(viewName); StringWriter stringWriter = new StringWriter(); try { mustache.execute(stringWriter, modelAndView.getModel()).close(); } catch (IOException e) { throw new RuntimeIOException(e); } return stringWriter.toString(); } MustacheTemplateEngine();  MustacheTemplateEngine(String resourceRoot);  MustacheTemplateEngine(MustacheFactory mustacheFactory); @Override String render(ModelAndView modelAndView); }
MustacheTemplateEngine extends TemplateEngine { @Override public String render(ModelAndView modelAndView) { String viewName = modelAndView.getViewName(); Mustache mustache = mustacheFactory.compile(viewName); StringWriter stringWriter = new StringWriter(); try { mustache.execute(stringWriter, modelAndView.getModel()).close(); } catch (IOException e) { throw new RuntimeIOException(e); } return stringWriter.toString(); } MustacheTemplateEngine();  MustacheTemplateEngine(String resourceRoot);  MustacheTemplateEngine(MustacheFactory mustacheFactory); @Override String render(ModelAndView modelAndView);  }