ScenarioGrid extends BaseGridWidget { @Override public boolean adjustSelection(final SelectionExtension direction, final boolean isShiftKeyDown) { final boolean selectionChanged = super.adjustSelection(direction, isShiftKeyDown); signalTestTools(); scenarioContextMenuRegistry.hideMenus(); scenarioContextMenuRegistry.hideErrorReportPopover(); return selectionChanged; } ScenarioGrid(AbstractScesimGridModel model,
                        ScenarioGridLayer scenarioGridLayer,
                        ScenarioGridRenderer renderer,
                        ScenarioContextMenuRegistry scenarioContextMenuRegistry); void setContent(AbstractScesimModel abstractScesimModel, ScenarioSimulationModel.Type type); GridWidget getGridWidget(); EventBus getEventBus(); void setEventBus(EventBus eventBus); void setDefaultSelectedDataCell(int cellX, int cellY); ScenarioSimulationContext getScenarioSimulationContext(); void setScenarioSimulationContext(ScenarioSimulationContext scenarioSimulationContext); @Override AbstractScesimGridModel getModel(); ScenarioSimulationModel.Type getType(); void clearSelections(); void setSelectedColumn(int columnIndex); void setSelectedColumnAndHeader(int headerRowIndex, int columnIndex); void ensureCellIsSelected(); void setSelectedCell(int rowIndex, int columnIndex); @Override boolean adjustSelection(final SelectionExtension direction, final boolean isShiftKeyDown);  }
@Test public void testAdjustSelection() { final int uiColumnIndex = 0; final int uiRowIndex = 0; final ScenarioGridColumn columnMock = mock(ScenarioGridColumn.class); when(columnMock.getIndex()).thenReturn(uiColumnIndex); when(scenarioGridModelMock.getColumns()).thenReturn(Collections.singletonList(columnMock)); final GridData.SelectedCell selectedHeaderCell = mock(GridData.SelectedCell.class); when(selectedHeaderCell.getColumnIndex()).thenReturn(uiColumnIndex); when(selectedHeaderCell.getRowIndex()).thenReturn(uiRowIndex); when(scenarioGridModelMock.getSelectedHeaderCells()).thenReturn(Collections.singletonList(selectedHeaderCell)); scenarioGridSpy.adjustSelection(mock(SelectionExtension.class), false); verify(scenarioGridSpy).signalTestTools(); verify(scenarioGridSpy).setSelectedColumn(eq(uiColumnIndex)); verify(eventBusMock).fireEvent(any(EnableTestToolsEvent.class)); verify(scenarioContextMenuRegistryMock, times(1)).hideMenus(); verify(scenarioContextMenuRegistryMock, times(1)).hideErrorReportPopover(); }