ScopeMap extends ReadOnlyEnumerationMap<Object> { public void clear() { Enumeration<String> keys = context.getKeys(); while (keys.hasMoreElements()) { context.removeValue(keys.nextElement()); } } ScopeMap(AttributeExtractor context); void clear(); Set<Map.Entry<String, Object>> entrySet(); Set<String> keySet(); Object put(String key, Object value); void putAll(Map<? extends String, ? extends Object> map); Object remove(Object key);  }
@SuppressWarnings("unchecked") @Test public void testClear() { Enumeration<String> keys = createMock(Enumeration.class); expect(extractor.getKeys()).andReturn(keys); expect(keys.hasMoreElements()).andReturn(true); expect(keys.nextElement()).andReturn("one"); expect(keys.hasMoreElements()).andReturn(true); expect(keys.nextElement()).andReturn("two"); expect(keys.hasMoreElements()).andReturn(false); extractor.removeValue("one"); extractor.removeValue("two"); replay(extractor, keys); map.clear(); verify(extractor, keys); }