VelocityScopeMap extends ScopeMap { public Set<String> keySet() { Set<String> set = new HashSet<String>(); for (Object key : request.getKeys()) { set.add((String) key); } return (set); } VelocityScopeMap(Context request); @Override Object remove(Object key); @Override Object put(String key, Object value); boolean containsKey(Object key); boolean isEmpty(); Set<String> keySet(); int size();  }
@Test public void testKeySet() { expect(request.getKeys()).andReturn(new Object[] {"one", "two"}); replay(request); Set<String> set = map.keySet(); assertEquals(2, set.size()); assertTrue(set.contains("one")); assertTrue(set.contains("two")); verify(request); }