KeyboardOperationInvokeContextMenuForSelectedCell extends BaseKeyboardOperation { @Override public boolean isExecutable(final GridWidget gridWidget) { final GridData model = gridWidget.getModel(); return model.getSelectedHeaderCells().size() > 0 || model.getSelectedCells().size() > 0; } KeyboardOperationInvokeContextMenuForSelectedCell(final GridLayer gridLayer); @Override TriStateBoolean isControlKeyDown(); @Override int getKeyCode(); @Override boolean isExecutable(final GridWidget gridWidget); @Override @SuppressWarnings("unused") boolean perform(final GridWidget gridWidget,
                           final boolean isShiftKeyDown,
                           final boolean isControlKeyDown);  }
@Test public void testIsExecutableNoSelectedCells() { doReturn(Collections.emptyList()).when(gridDataMock).getSelectedCells(); assertThat(testedOperation.isExecutable(gridWidgetMock)).isFalse(); }
@Test public void testIsExecutableSelectedHeader() { doReturn(Collections.singletonList(mock(GridData.SelectedCell.class))).when(gridDataMock).getSelectedHeaderCells(); assertThat(testedOperation.isExecutable(gridWidgetMock)).isTrue(); }
@Test public void testIsExecutableSelectedCells() { doReturn(Collections.singletonList(mock(GridData.SelectedCell.class))).when(gridDataMock).getSelectedCells(); assertThat(testedOperation.isExecutable(gridWidgetMock)).isTrue(); }