@Test(expected = CannotRenderException.class)
public void testRenderException1() throws IOException, ServletException {

    ApplicationContext applicationContext = createMock(ServletApplicationContext.class);
    ServletContext servletContext = createMock(ServletContext.class);
    GenericServlet servlet = createMockBuilder(GenericServlet.class).createMock();
    ServletConfig servletConfig = createMock(ServletConfig.class);
    ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
    replay(servlet, servletConfig);
    servlet.init(servletConfig);
    expect(applicationContext.getContext()).andReturn(servletContext).anyTimes();
    expect(servletContext.getRealPath(isA(String.class))).andReturn(null).anyTimes();
    URL resource = getClass().getResource("/test.ftl");
    expect(servletContext.getResource(isA(String.class))).andReturn(resource).anyTimes();
    replay(applicationContext, servletContext, objectWrapper);
    FreemarkerRenderer renderer = FreemarkerRendererBuilder
            .createInstance().setApplicationContext(applicationContext)
            .setParameter("TemplatePath", "/")
            .setParameter("NoCache", "true")
            .setParameter("ContentType", "text/html")
            .setParameter("template_update_delay", "0")
            .setParameter("default_encoding", "ISO-8859-1")
            .setParameter("number_format", "0.##########").build();
    ServletRequest request = createMock(ServletRequest.class);
    replay(request);
    try {
        renderer.render(null, request);
    } finally {
        verify(applicationContext, servletContext, request, servlet,
                servletConfig, objectWrapper);
    }
}