MenuService { public void setVisible(MenuBar menu, String destination, boolean visible) { setVisible(menu, destination, null, visible); }  MenuBar constructMenu(String rootName); void setLastVisited(MenuBar menuBar, String destination); String getLastVisited(); void setVisible(MenuBar menu, String destination, boolean visible); void setVisible(MenuBar menu, String destination, String mode, boolean visible); static final String DESCRIPTION; static final String DESTINATION; static final String DISPLAY_NAME; static final String MODE; static final String TAB_INDEX; }
@Test public void testSetVisible() { MenuBar bar = menuService.constructMenu("ocs.menu"); menuService.setVisible(bar, "Destination 1.1", false); MenuItem first = bar.getItems().get(0); MenuItem firstSub = (MenuItem) first.getSubMenu().getChildren().findFirst().orElse(null); assertTrue(first.isVisible()); assertFalse(firstSub.isVisible()); menuService.setVisible(bar, "Destination 1.1", true); assertTrue(firstSub.isVisible()); menuService.setVisible(bar, "Destination 1.1", false); menuService.setVisible(bar, "Destination 1.2", false); menuService.setVisible(bar, "Destination 1.3", false); assertFalse(firstSub.isVisible()); }