WorkbenchMenuStandardNavBarView extends WorkbenchMenuNavBarView { @Override public void clearContextMenu() { super.clearContextMenu(); for (final ComplexPanel contextContainer : getContextContainerWidgetMap().values()) { contextContainer.clear(); contextContainer.removeFromParent(); } getContextContainerWidgetMap().clear(); }  @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);  }
@Test public void testClearContextMenu() { final String menuId = "menuId"; when(navbarNav.iterator()).thenReturn(Collections.<Widget>emptyList().iterator()); when(listItem.getParent()).thenReturn(mock(Widget.class)); workbenchMenuStandardNavBarView.addContextMenuItem(menuId, "contextMenuItemId", "labelContextMenu", null, null, null); workbenchMenuStandardNavBarView.addContextGroupMenuItem(menuId, "contextGroupMenuId", "labelContextGroup", null); workbenchMenuStandardNavBarView.clearContextMenu(); assertTrue(workbenchMenuStandardNavBarView.getContextContainerWidgetMap().isEmpty()); assertTrue(workbenchMenuStandardNavBarView.getMenuItemContextWidgetMap().isEmpty()); verify(anchorListItem).clear(); verify(anchorListItem).removeFromParent(); verify(dropDownMenu).clear(); verify(dropDownMenu).removeFromParent(); }