StackWizardSettings implements WizardSettings { public Set<String> keySet() { Set<String> keys = new HashSet<String>(); for (IdMapTuple tuple : _pageStack) { keys.addAll(tuple.map.keySet()); } return keys; } StackWizardSettings(); Set<String> keySet(); boolean containsKey(String key); void rollBack(); void commit(); void newPage(String id); Object put(String key, Object value); @Override Object get(String key); @Override String toString(); @Override void clear(); @Override boolean containsValue(Object value); @Override boolean isEmpty(); @Override void putAll(Map<? extends String, ? extends Object> m); @Override Object remove(String key); void removeAll(Object key); @Override int size(); boolean settingsEquals(WizardSettings ws);  }
@Test public void testKeySet(){ final String key1 = "key1"; final String key2 = "key2"; final String key3 = "key3"; final String value1 = "value1"; final String value2 = "value2"; final String value3 = "value3"; String[] oracle1 = {key1, key2}; String[] oracle2 = {key1, key2, key3}; WizardSettings s = new StackWizardSettings(); s.newPage("page1"); s.put(key1, value1); s.put(key2, value2); Set<String> keys = s.keySet(); assertEquals(oracle1, keys); s.newPage("page2"); s.put(key3, value3); keys = s.keySet(); assertEquals(oracle2, keys); s.rollBack(); keys = s.keySet(); assertEquals(oracle1, keys); }