ScenarioSimulationMainGridPanelMouseMoveHandler extends AbstractScenarioSimulationGridPanelHandler implements ScenarioSimulationGridPanelMouseMoveHandler { @Override protected boolean manageBodyCoordinates(Integer uiRowIndex, Integer uiColumnIndex) { if (uiColumnIndex == -1 || uiRowIndex == -1) { return false; } if (uiRowIndex.equals(currentlyShownBodyRowIndex) && uiColumnIndex.equals(currentlyShownBodyColumnIndex) && errorReportPopupPresenter.isShown()) { return true; } currentlyShownBodyRowIndex = uiRowIndex; currentlyShownBodyColumnIndex = uiColumnIndex; final Optional<AbstractScesimModel<? extends AbstractScesimData>> optionalAbstractScesimModel = scenarioGrid.getModel().getAbstractScesimModel(); final AbstractScesimModel<? extends AbstractScesimData> scesimModel = optionalAbstractScesimModel.orElseThrow(IllegalStateException::new); final AbstractScesimData scenarioByIndex = scesimModel.getDataByIndex(uiRowIndex); final FactMapping factMapping = scesimModel.getScesimModelDescriptor().getFactMappingByIndex(uiColumnIndex); final Optional<FactMappingValue> factMappingValueOptional = scenarioByIndex.getFactMappingValue(factMapping); factMappingValueOptional.ifPresent(factMappingValue -> manageFactMappingValue(factMappingValue, uiRowIndex, uiColumnIndex)); return true; }  @Override void onNodeMouseMove(NodeMouseMoveEvent event); @Override void hidePopover(); @Override void setErrorReportPopupPresenter(ErrorReportPopoverPresenter errorReportPopupPresenter);  }
@Test public void manageBodyCoordinatesSameCellIsShown() { mouseMoveHandler.currentlyShownBodyRowIndex = ROW_INDEX; mouseMoveHandler.currentlyShownBodyColumnIndex = COLUMN_INDEX; doReturn(true).when(errorReportPopupPresenterMock).isShown(); mouseMoveHandler.manageBodyCoordinates(ROW_INDEX, COLUMN_INDEX); verify(scenarioGridMock, never()).getModel(); verify(simulationMock, never()).getDataByIndex(eq(ROW_INDEX)); }