ScenarioSimulationContext { public Optional<AbstractScesimGridModel> getSelectedScenarioGridModel() { return getSelectedScenarioGridLayer().map(ScenarioGridLayer::getScenarioGrid).map(ScenarioGrid::getModel); } ScenarioSimulationContext(ScenarioGridWidget simulationGridWidget, ScenarioGridWidget backgroundGridWidget); Status getStatus(); void setStatus(Status status); ScenarioSimulationEditorPresenter getScenarioSimulationEditorPresenter(); void setScenarioSimulationEditorPresenter(ScenarioSimulationEditorPresenter scenarioSimulationEditorPresenter); TestToolsView.Presenter getTestToolsPresenter(); void setTestToolsPresenter(TestToolsView.Presenter testToolsPresenter); SortedMap<String, FactModelTree> getDataObjectFieldsMap(); void setDataObjectFieldsMap(SortedMap<String, FactModelTree> dataObjectFieldsMap); Settings getSettings(); void setSettings(Settings settings); void setDataObjectsInstancesName(Set<String> dataObjectsInstancesName); Optional<ScenarioGridWidget> getSelectedScenarioGridWidget(); ScenarioGrid getSimulationGrid(); ScenarioGrid getBackgroundGrid(); Optional<ScenarioGridPanel> getSelectedScenarioGridPanel(); ScenarioGridPanel getScenarioGridPanelByGridWidget(GridWidget gridWidget); AbstractScesimGridModel getAbstractScesimGridModelByGridWidget(GridWidget gridWidget); AbstractScesimModel<T> getAbstractScesimModelByGridWidget(GridWidget gridWidget); Optional<AbstractScesimGridModel> getSelectedScenarioGridModel(); Optional<ScenarioGridLayer> getSelectedScenarioGridLayer(); Optional<GridWidget> getSelectedGridWidget(); PlaceManager getPlaceManager(); void setPlaceManager(PlaceManager placeManager); PlaceRequest getTestToolsRequest(); void setTestToolsRequest(PlaceRequest testToolsRequest); void setStatusSimulationIfEmpty(); long getId(); CollectionEditorSingletonDOMElementFactory getCollectionEditorSingletonDOMElementFactory(GridWidget gridWidget); ScenarioCellTextAreaSingletonDOMElementFactory getScenarioCellTextAreaSingletonDOMElementFactory(GridWidget gridWidget); ScenarioHeaderTextBoxSingletonDOMElementFactory getScenarioHeaderTextBoxSingletonDOMElementFactory(GridWidget gridWidget); ScenarioExpressionCellTextAreaSingletonDOMElementFactory getScenarioExpressionCellTextAreaSingletonDOMElementFactory(GridWidget gridWidget); void setUndoButtonEnabledStatus(boolean enabled); void setRedoButtonEnabledStatus(boolean enabled);  }
@Test public void getSelectedScenarioGridModelSIMULATION() { when(backgroundGridWidgetSpy.isSelected()).thenReturn(false); when(scenarioGridWidgetSpy.isSelected()).thenReturn(true); assertEquals(Optional.of(scenarioGridModelMock), scenarioSimulationContextLocal.getSelectedScenarioGridModel()); }
@Test public void getSelectedScenarioGridModelBACKGROUND() { when(backgroundGridWidgetSpy.isSelected()).thenReturn(true); when(scenarioGridWidgetSpy.isSelected()).thenReturn(false); assertEquals(Optional.of(backgroundGridModelMock), scenarioSimulationContextLocal.getSelectedScenarioGridModel()); }
@Test public void getSelectedScenarioGridModelNone() { when(backgroundGridWidgetSpy.isSelected()).thenReturn(false); when(scenarioGridWidgetSpy.isSelected()).thenReturn(false); assertEquals(Optional.empty(), scenarioSimulationContextLocal.getSelectedScenarioGridModel()); }