GridContextMenu extends
        ContextMenuBase<GridContextMenu<T>, GridMenuItem<T>, GridSubMenu<T>> implements HasGridMenuItems<T> { @Override public GridMenuItem<T> addItem(String text, ComponentEventListener<GridContextMenuItemClickEvent<T>> clickListener) { GridMenuItem<T> menuItem = getMenuManager().addItem(text); if (clickListener != null) { menuItem.addMenuItemClickListener(clickListener); } return menuItem; } GridContextMenu();  GridContextMenu(Grid<T> target); @Override void setTarget(Component target); @Override GridMenuItem<T> addItem(String text,
            ComponentEventListener<GridContextMenuItemClickEvent<T>> clickListener); @Override GridMenuItem<T> addItem(Component component,
            ComponentEventListener<GridContextMenuItemClickEvent<T>> clickListener); Registration addGridContextMenuOpenedListener(
            ComponentEventListener<GridContextMenuOpenedEvent<T>> listener); SerializablePredicate<T> getDynamicContentHandler(); void setDynamicContentHandler(
            SerializablePredicate<T> dynamicContentHandler);  }
@Test public void addTextItem_delegateToMenuManager() { TestContextMenu menu = new TestContextMenu(); menu.addItem("foo", null); Mockito.verify(menuManager).addItem("foo", null); }
@Test public void addComponentItem_delegateToMenuManager() { TestContextMenu menu = new TestContextMenu(); Component component = Mockito.mock(Component.class); menu.addItem(component, null); Mockito.verify(menuManager).addItem(component, null); }
@Test public void addItemsWithNullClickListener_doesNotThrow() { GridContextMenu<Object> gridContextMenu = new GridContextMenu<>(); GridMenuItem<Object> foo = gridContextMenu.addItem("foo", null); gridContextMenu.addItem(new NativeButton(), null); foo.getSubMenu().addItem("bar", null); foo.getSubMenu().addItem(new NativeButton(), null); }