SelectionManager implements SelectionProvider, PropertyChangeListener { private void clearSelections(Object skipProvider) { for (SelectionProvider provider:containers) { if (skipProvider != provider) { provider.removeSelectionChangeListener(this); provider.clearCurrentSelections(); provider.addSelectionChangeListener(this); } } } SelectionManager(Object eventSource); void manageComponent(Component c); @Override void addSelectionChangeListener(PropertyChangeListener listener); @Override Collection<View> getSelectedManifestations(); @Override void removeSelectionChangeListener(PropertyChangeListener listener); @Override void clearCurrentSelections(); @Override void propertyChange(PropertyChangeEvent evt);  }
@Test public void testClearSelections() { Object source = new Object(); SelectionManager sm = new SelectionManager(source); MockRoot root = new MockRoot(); sm.manageComponent(root); Assert.assertTrue(root.clears == 0); sm.clearCurrentSelections(); Assert.assertTrue(root.clears == 1); }