### Question:
VelocityTemplateEngine implements TemplateEngine { @Override public String renderTemplate(String template, ValueProvider context) { StringWriter writer = new StringWriter(); contextAdapter.setValueProvider(context); Velocity.evaluate(contextAdapter, writer, "", template); return writer.toString(); } VelocityTemplateEngine(); @Override String renderTemplate(String template, ValueProvider context);  }### Answer:
@Test public void renderTemplate() { when(valProvider.lookupValue("name")).thenReturn("Noddy"); assertThat(engine.renderTemplate("Hello ${name}", valProvider), equalTo("Hello Noddy")); }
@Test public void renderTemplate_undefinedValue() { assertThat(engine.renderTemplate("Hello ${name}", valProvider), equalTo("Hello ${name}")); }