TilesContextBeanELResolver extends ELResolver { @Override public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) { List<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>(); Request request = (Request) context .getContext(Request.class); for (String scope : request.getAvailableScopes()) { collectBeanInfo(request.getContext(scope), list); } return list.iterator(); }  @Override Class<?> getCommonPropertyType(ELContext context, Object base); @Override Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
            Object base); @Override Class<?> getType(ELContext context, Object base, Object property); @Override Object getValue(ELContext context, Object base, Object property); @Override boolean isReadOnly(ELContext context, Object base, Object property); @Override void setValue(ELContext context, Object base, Object property,
            Object value);  }
@Test public void testGetFeatureDescriptors() { Map<String, Object> requestScope = new HashMap<String, Object>(); Map<String, Object> sessionScope = new HashMap<String, Object>(); Map<String, Object> applicationScope = new HashMap<String, Object>(); requestScope.put("object1", "value"); sessionScope.put("object2", new Integer(1)); applicationScope.put("object3", new Float(2.0)); Request request = createMock(Request.class); expect(request.getContext("request")).andReturn(requestScope) .anyTimes(); expect(request.getContext("session")).andReturn(sessionScope) .anyTimes(); ApplicationContext applicationContext = createMock(ApplicationContext.class); expect(request.getContext("application")).andReturn( applicationScope).anyTimes(); expect(request.getAvailableScopes()).andReturn( Arrays.asList(new String[] { "request", "session", "application" })) .anyTimes(); replay(request, applicationContext); ELContext context = new ELContextImpl(resolver); context.putContext(Request.class, request); context.putContext(ApplicationContext.class, applicationContext); List<FeatureDescriptor> expected = new ArrayList<FeatureDescriptor>(); resolver.collectBeanInfo(requestScope, expected); resolver.collectBeanInfo(sessionScope, expected); resolver.collectBeanInfo(applicationScope, expected); Iterator<FeatureDescriptor> featureIt = resolver.getFeatureDescriptors( context, null); Iterator<FeatureDescriptor> expectedIt = expected.iterator(); while (featureIt.hasNext() && expectedIt.hasNext()) { FeatureDescriptor expectedDescriptor = expectedIt.next(); FeatureDescriptor descriptor = featureIt.next(); assertEquals("The feature is not the same", expectedDescriptor .getDisplayName(), descriptor.getDisplayName()); assertEquals("The feature is not the same", expectedDescriptor .getName(), descriptor.getName()); assertEquals("The feature is not the same", expectedDescriptor .getShortDescription(), descriptor.getShortDescription()); assertEquals("The feature is not the same", expectedDescriptor .getValue("type"), descriptor.getValue("type")); assertEquals("The feature is not the same", expectedDescriptor .getValue("resolvableAtDesignTime"), descriptor .getValue("resolvableAtDesignTime")); assertEquals("The feature is not the same", expectedDescriptor .isExpert(), descriptor.isExpert()); assertEquals("The feature is not the same", expectedDescriptor .isHidden(), descriptor.isHidden()); assertEquals("The feature is not the same", expectedDescriptor .isPreferred(), descriptor.isPreferred()); } assertTrue("The feature descriptors are not of the same size", !featureIt.hasNext() && !expectedIt.hasNext()); }