@Test
public void testGetParameter() throws TemplateModelException {

    Template template = createMock(Template.class);
    TemplateHashModel rootDataModel = createMock(TemplateHashModel.class);
    Writer out = createMock(Writer.class);
    expect(template.getMacros()).andReturn(new HashMap<String, Macro>());
    replay(template, rootDataModel, out);
    Environment env = new Environment(template, rootDataModel, out);
    TemplateNumberModel model = createMock(TemplateNumberModel.class);
    expect(model.getAsNumber()).andReturn(new Integer(42)).anyTimes();
    @SuppressWarnings("unchecked")
    Map<String, TemplateModel> params = createMock(Map.class);
    TemplateDirectiveBody body = createMock(TemplateDirectiveBody.class);
    expect(params.get(eq("notnullParam"))).andReturn(model).anyTimes();
    expect(params.get(eq("nullParam"))).andReturn(null).anyTimes();
    replay(model, params, body);
    FreemarkerAutotagRuntime runtime = new FreemarkerAutotagRuntime();
    runtime.execute(env, params, new TemplateModel[0], body);
    Object notnullParam = runtime.getParameter("notnullParam", Object.class, null);
    Object nullParam = runtime.getParameter("nullParam", Object.class, null);
    int notnullParamDefault = runtime.getParameter("notnullParam", Integer.class, new Integer(24));
    int nullParamDefault = runtime.getParameter("nullParam", Integer.class, new Integer(24));
    assertEquals(42, notnullParam);
    assertEquals(null, nullParam);
    assertEquals(42, notnullParamDefault);
    assertEquals(24, nullParamDefault);
    verify(template, rootDataModel, out, model, params, body);
}