TilesContextBeanVariableResolverFactory extends
        ReadOnlyVariableResolverFactory { @Override public VariableResolver createVariableResolver(String name) { return new TilesContextBeanVariableResolver(name); } TilesContextBeanVariableResolverFactory(TilesRequestContextHolder requestHolder); @Override VariableResolver createVariableResolver(String name); boolean isTarget(String name);  }
@Test public void testCreateVariableResolver() { Map<String, Object> requestScope = new HashMap<String, Object>(); requestScope.put("one", 1); expect(request.getContext("request")).andReturn(requestScope).anyTimes(); Map<String, Object> applicationScope = new HashMap<String, Object>(); applicationScope.put("two", 2); Map<String, Object> sessionScope = new HashMap<String, Object>(); sessionScope.put("three", "three"); expect(request.getContext("session")).andReturn(sessionScope).anyTimes(); expect(request.getAvailableScopes()).andReturn( Arrays.asList(new String[] { "request", "session", "application" })) .anyTimes(); expect(request.getContext("application")).andReturn(applicationScope).anyTimes(); replay(request, applicationContext); VariableResolver resolver = factory.createVariableResolver("one"); assertEquals(1, resolver.getValue()); assertEquals(Integer.class, resolver.getType()); resolver = factory.createVariableResolver("two"); assertEquals(2, resolver.getValue()); resolver = factory.createVariableResolver("three"); assertEquals("three", resolver.getValue()); resolver = factory.createVariableResolver("four"); assertEquals(Object.class, resolver.getType()); assertNull(resolver.getValue()); verify(request, applicationContext); }