@Test
public void testGetValue() throws TemplateModelException {

    Template template = createMock(Template.class);
    TemplateHashModel model = createMock(TemplateHashModel.class);
    TemplateScalarModel valueModel = createMock(TemplateScalarModel.class);
    Configuration configuration = createMock(Configuration.class);
    ObjectWrapper objectWrapper = createMock(ObjectWrapper.class);
    Writer writer = new StringWriter();
    expect(template.getMacros()).andReturn(new HashMap<Object, Object>());
    expect(valueModel.getAsString()).andReturn("value");
    replay(template, model, valueModel, configuration, objectWrapper);
    Environment env = new Environment(template, model, writer);
    env.setVariable("key", valueModel);
    EnvironmentScopeExtractor extractor = new EnvironmentScopeExtractor(env);
    assertEquals("value", extractor.getValue("key"));
    verify(template, model, valueModel, configuration, objectWrapper);
}