VelocityRenderer implements Renderer { public boolean isRenderable(String path, Request request) { return path != null && path.startsWith("/") && path.endsWith(".vm"); } VelocityRenderer(VelocityView velocityView); @Override void render(String path, Request request); boolean isRenderable(String path, Request request);  }
@Test public void testIsRenderable() { VelocityView view = createMock(VelocityView.class); replay(view); Renderer renderer = new VelocityRenderer(view); assertTrue(renderer.isRenderable("/my/template.vm", null)); assertFalse(renderer.isRenderable("my/template.vm", null)); assertFalse(renderer.isRenderable("/my/template.jsp", null)); verify(view); }