ScopeELResolver extends ELResolver { @Override public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) { if (base != null) { List<FeatureDescriptor> retValue = Collections.emptyList(); return retValue.iterator(); } List<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>(); Request request = (Request) context .getContext(Request.class); for (String scope : request.getAvailableScopes()) { FeatureDescriptor descriptor = new FeatureDescriptor(); descriptor.setDisplayName(scope + "Scope"); descriptor.setExpert(false); descriptor.setHidden(false); descriptor.setName(scope + "Scope"); descriptor.setPreferred(true); descriptor.setShortDescription(""); descriptor.setValue("type", Map.class); descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE); list.add(descriptor); } 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() { ELContext elContext = createMock(ELContext.class); Request request = createMock(Request.class); expect(elContext.getContext(Request.class)).andReturn(request); expect(request.getAvailableScopes()).andReturn(Arrays.asList(new String[] {"one", "two"})); replay(elContext, request); assertFalse(resolver.getFeatureDescriptors(elContext, new Integer(1)).hasNext()); Iterator<FeatureDescriptor> descriptors = resolver.getFeatureDescriptors(elContext, null); FeatureDescriptor descriptor = descriptors.next(); assertEquals("oneScope", descriptor.getName()); descriptor = descriptors.next(); assertEquals("twoScope", descriptor.getName()); assertFalse(descriptors.hasNext()); verify(elContext, request); }