@Test(expected = NotAvailableFreemarkerServletException.class)
public void testGetServletContextHashModelException() throws TemplateModelException {

    GenericServlet servlet = createMock(GenericServlet.class);
    ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
    replay(servlet, objectWrapper);
    expect(model.get("Application")).andThrow(new TemplateModelException());
    replay(template, model);
    try {
        env = new Environment(template, model, writer);
        locale = Locale.ITALY;
        env.setLocale(locale);
        FreemarkerRequestUtil.getServletContextHashModel(env);
    } finally {
        verify(template, model, servlet, objectWrapper);
    }
}