PersistentFieldManagerImpl implements PersistentFieldManager { public void discardChanges(String pageName) { for (PersistentFieldStrategy strategy : strategies.values()) { strategy.discardChanges(pageName); } } PersistentFieldManagerImpl(MetaDataLocator locator, Map<String, PersistentFieldStrategy> strategies); PersistentFieldBundle gatherChanges(String pageName); void discardChanges(String pageName); void discardChanges(String pageName, String strategyName); void postChange(String pageName, ComponentResources resources, String fieldName, Object newValue);  }
@Test public void discard_changes() { PersistentFieldStrategy strat1 = newPersistentFieldStrategy(); PersistentFieldStrategy strat2 = newPersistentFieldStrategy(); Map<String, PersistentFieldStrategy> strategies = newMap(); strategies.put("foo", strat1); strategies.put("bar", strat2); String pageName = "gnip.gnop"; strat1.discardChanges(pageName); strat2.discardChanges(pageName); replay(); PersistentFieldManager manager = new PersistentFieldManagerImpl(null, strategies); manager.discardChanges(pageName); verify(); }