ApplicationScopeExtractor implements AttributeExtractor { @SuppressWarnings("unchecked") @Override public Enumeration<String> getKeys() { return context.getAttributeNames(); } ApplicationScopeExtractor(ServletContext context); @Override void setValue(String name, Object value); @Override void removeValue(String name); @SuppressWarnings("unchecked") @Override Enumeration<String> getKeys(); @Override Object getValue(String key);  }
@SuppressWarnings("unchecked") @Test public void testGetKeys() { Enumeration<String> keys = createMock(Enumeration.class); expect(context.getAttributeNames()).andReturn(keys); replay(context, keys); assertEquals(keys, extractor.getKeys()); verify(context, keys); }