TemplateEngineText implements TemplateEngine { @Override public void invoke(Context context, Result result) { ResponseStreams responseStreams = context.finalizeHeaders(result); try (Writer outputWriter = responseStreams.getWriter()) { outputWriter.write(result.getRenderable().toString()); } catch (IOException e) { logger.error("Error while rendering plain text", e); } } @Inject  TemplateEngineText(); @Override void invoke(Context context, Result result); @Override String getContentType(); @Override String getSuffixOfTemplatingEngine();  }
@Test public void testTextRendering() throws IOException { TemplateEngineText textEngine = new TemplateEngineText(); textEngine.invoke(context, result); String text = writer.toString(); assertEquals("{apples=oranges, cars=trucks}", text); verify(context).finalizeHeaders(result); }