TilesContextVariableResolverFactory extends
        ReadOnlyVariableResolverFactory { @Override public VariableResolver createVariableResolver(String name) { VariableResolver resolver = null; PropertyDescriptor descriptor = requestBeanInfo.getMappedDescriptors(Request.class).get(name); if (descriptor != null) { resolver = new RequestVariableResolver(name, descriptor); } else { descriptor = requestBeanInfo.getMappedDescriptors(ApplicationContext.class).get(name); if (descriptor != null) { resolver = new ApplicationVariableResolver(name, descriptor); } } return resolver; } TilesContextVariableResolverFactory(TilesRequestContextHolder requestHolder); boolean isTarget(String name); @Override VariableResolver createVariableResolver(String name);  }
@SuppressWarnings("unchecked") @Test public void testCreateVariableResolver() { Map<String, String> header = createMock(Map.class); Map<String, Object> requestScope = new HashMap<String, Object>(); requestScope.put("one", 1); Map<String, Object> applicationScope = new HashMap<String, Object>(); applicationScope.put("two", 2); expect(request.getApplicationContext()).andReturn(applicationContext); expect(applicationContext.getApplicationScope()).andReturn(applicationScope); expect(request.getHeader()).andReturn(header); replay(request, applicationContext, header); VariableResolver resolver = factory.createVariableResolver("header"); assertEquals(Map.class, resolver.getType()); assertEquals(header, resolver.getValue()); resolver = factory.createVariableResolver("applicationScope"); assertEquals(applicationScope, resolver.getValue()); assertEquals(Map.class, resolver.getType()); verify(header); }