@Test
public void testGetVariableResolver() {

    VariableResolverFactory nextFactory = createMock(VariableResolverFactory.class);
    VariableResolver nextResolver = createMock(VariableResolver.class);
    VariableResolver requestResolver = createMock(VariableResolver.class);
    VariableResolver applicationResolver = createMock(VariableResolver.class);
    expect(nextFactory.getVariableResolver("other")).andReturn(nextResolver);
    expect(nextFactory.isResolveable("other")).andReturn(true);
    expect(factory.isTarget("requestScope")).andReturn(true).anyTimes();
    expect(factory.isTarget("applicationScope")).andReturn(true).anyTimes();
    expect(factory.isTarget("other")).andReturn(false).anyTimes();
    expect(factory.createVariableResolver("requestScope")).andReturn(requestResolver);
    expect(factory.createVariableResolver("applicationScope")).andReturn(applicationResolver);
    replay(factory, request, applicationContext, nextFactory, nextResolver, requestResolver, applicationResolver);
    factory.setNextFactory(nextFactory);
    VariableResolver resolver = factory.getVariableResolver("requestScope");
    assertEquals(requestResolver, resolver);
    resolver = factory.getVariableResolver("requestScope"); // again to test caching
    assertEquals(requestResolver, resolver);
    resolver = factory.getVariableResolver("applicationScope");
    assertEquals(applicationResolver, resolver);
    resolver = factory.getVariableResolver("other");
    assertEquals(nextResolver, resolver);
    verify(factory, request, applicationContext, nextFactory, nextResolver, requestResolver, applicationResolver);
}