WorkbenchMenuCompactNavBarView extends WorkbenchMenuNavBarView { @Override public void selectMenuItem(final String id) { super.selectMenuItem(id); final String menuLabel = menuLabelMap.get(id); text.setText(menuLabel == null ? "" : menuLabel); for (ComplexPanel context : menuItemContextMenus.get(id)) { navbarNav.add(context); } }  @Override void addMenuItem(final String id,
                            final String label,
                            final String parentId,
                            final Command command,
                            final MenuPosition position); @Override void addCustomMenuItem(final Widget menu,
                                  final MenuPosition position); @Override void addGroupMenuItem(final String id,
                                 final String label,
                                 final MenuPosition position); @Override void addContextMenuItem(
            final String menuItemId,
            final String id,
            final String label,
            final String parentId,
            final Command command,
            final MenuPosition position); @Override void addContextGroupMenuItem(final String menuItemId,
                                        final String id,
                                        final String label,
                                        final MenuPosition position); @Override void clearContextMenu(); @Override void selectMenuItem(final String id); @Override void clear();  }
@Test public void testSelectMenuItem() { final String menuId = "menuId"; final String label = "label"; final String labelContext = "labelContext"; when(dropDownMenu.iterator()).thenReturn(Collections.<Widget>emptyList().iterator()); workbenchMenuCompactNavBarView.addContextMenuItem(menuId, "contextMenuId", labelContext, null, null, null); workbenchMenuCompactNavBarView.addMenuItem(menuId, label, null, null, null); workbenchMenuCompactNavBarView.selectMenuItem(menuId); verify(navbarNav).add(anchorListItem); verify(text).setText(label); verify(anchorListItem).setText(labelContext); verify(anchorListItem).setText(label); verify(dropDownMenu).add(anchorListItem); }