@SuppressWarnings("unchecked")
@Test
public void testKeySet() {

    Template template = createMock(Template.class);
    TemplateHashModel model = createMock(TemplateHashModel.class);
    Configuration configuration = createMock(Configuration.class);
    Set<String> names = createMock(Set.class);
    Writer writer = new StringWriter();
    expect(template.getMacros()).andReturn(new HashMap<Object, Object>());
    expect(template.getConfiguration()).andReturn(configuration);
    expect(configuration.getSharedVariableNames()).andReturn(names);
    replay(template, model, configuration, names);
    Environment env = new Environment(template, model, writer);
    EnvironmentScopeMap map = new EnvironmentScopeMap(env);
    assertEquals(names, map.keySet());
    verify(template, model, configuration, names);
}