DefinitionRenderer implements Renderer { @Override public void render(String path, Request request) throws IOException { if (path == null) { throw new CannotRenderException("Cannot dispatch a null path"); } container.render(path, request); } DefinitionRenderer(TilesContainer container); @Override void render(String path, Request request); boolean isRenderable(String path, Request request);  }
@Test public void testWrite() throws IOException { Request requestContext = createMock(Request.class); container.render("my.definition", requestContext); replay(requestContext, container); renderer.render("my.definition", requestContext); verify(requestContext, container); }
@Test(expected = CannotRenderException.class) public void testRenderException() throws IOException { Request requestContext = createMock(Request.class); replay(requestContext, container); try { renderer.render(null, requestContext); } finally { verify(requestContext, container); } }