ScenarioGrid extends BaseGridWidget { protected void signalTestToolsHeaderCellSelected(final ScenarioGridColumn scenarioGridColumn, final GridData.SelectedCell selectedHeaderCell, final int uiColumnIndex) { final ScenarioHeaderMetaData scenarioHeaderMetaData = getColumnScenarioHeaderMetaData(scenarioGridColumn, selectedHeaderCell.getRowIndex()); if (scenarioGridColumn.isInstanceAssigned() && scenarioHeaderMetaData.getMetadataType().equals(ScenarioHeaderMetaData.MetadataType.INSTANCE)) { eventBus.fireEvent(new ReloadTestToolsEvent(true, true)); } else { String group = ScenarioSimulationUtils.getOriginalColumnGroup(scenarioHeaderMetaData.getColumnGroup()); final EnableTestToolsEvent enableTestToolsEvent = getEnableTestToolsEvent(this, scenarioGridColumn, scenarioHeaderMetaData, uiColumnIndex, group); eventBus.fireEvent(enableTestToolsEvent); } } 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 signalTestToolsHeaderCellSelected() { 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.signalTestToolsHeaderCellSelected(columnMock, selectedHeaderCell, uiColumnIndex); verify(eventBusMock, times(1)).fireEvent(isA(EnableTestToolsEvent.class)); }