TaggedComponentManager { public void hideIfOthersHidden(Component component, Component... others) { boolean shouldShow = false; for (Component other : others) { if (other.isVisible()) { shouldShow = true; break; } } component.setVisible(shouldShow); }  void tagComponents(String tag, Component... componentsToTag); Collection<Component> getComponentsForTag(String tag); void show(String tag, boolean condition); void hide(String tag, boolean condition); void disable(String tag, boolean condition); void enable(String tag, boolean condition); void showAll(); void hideIfOthersHidden(Component component, Component... others);  }
@Test public void testHideIfOthersHidden() { manager.hideIfOthersHidden(component1, component2); assertTrue(component1.isVisible()); component2.setVisible(false); manager.hideIfOthersHidden(component1, component2); assertFalse(component1.isVisible()); }