ScenarioSimulationMainGridPanelClickHandler extends AbstractScenarioSimulationGridPanelHandler implements ScenarioSimulationGridPanelClickHandler { @Override protected boolean manageBodyCoordinates(Integer uiRowIndex, Integer uiColumnIndex) { final GridCell<?> cell = scenarioGrid.getModel().getCell(uiRowIndex, uiColumnIndex); if (cell == null) { return false; } else { scenarioGrid.getModel().selectCell(uiRowIndex, uiColumnIndex); eventBus.fireEvent(new DisableTestToolsEvent()); return true; } }  void setScenarioContextMenuRegistry(ScenarioContextMenuRegistry scenarioContextMenuRegistry); @Override void setEventBus(EventBus eventBus); @Override void onClick(ClickEvent event); @Override @SuppressWarnings("unchecked") void onContextMenu(final ContextMenuEvent event); @Override void hideMenus();  }
@Test public void manageBodyCoordinates_NullCell() { scenarioSimulationMainGridPanelClickHandler.manageBodyCoordinates(ROW_INDEX, COLUMN_INDEX); verify(scenarioGridMock.getModel(), times(1)).getCell(eq(ROW_INDEX), eq(COLUMN_INDEX)); verify(scenarioGridMock.getModel(), never()).selectCell(anyInt(), anyInt()); verify(eventBusMock, times(0)).fireEvent(isA(GwtEvent.class)); }
@Test public void manageBodyCoordinates_WithCell() { doReturn(scenarioGridCellMock).when(scenarioGridModelMock).getCell(ROW_INDEX, COLUMN_INDEX); scenarioSimulationMainGridPanelClickHandler.manageBodyCoordinates(ROW_INDEX, COLUMN_INDEX); verify(scenarioGridMock.getModel(), times(1)).getCell(eq(ROW_INDEX), eq(COLUMN_INDEX)); verify(scenarioGridMock.getModel(), times(1)).selectCell(ROW_INDEX, COLUMN_INDEX); verify(eventBusMock, times(1)).fireEvent(isA(DisableTestToolsEvent.class)); }