ScenarioSimulationEditorBusinessCentralWrapper extends KieEditor<ScenarioSimulationModel> implements ScenarioSimulationEditorWrapper { @Override public void populateDocks(String identifier) { if (CoverageReportPresenter.IDENTIFIER.equals(identifier)) { scenarioSimulationBusinessCentralDocksHandler.getCoverageReportPresenter().ifPresent(presenter -> { setCoverageReport(presenter); presenter.setCurrentPath(scenarioSimulationEditorPresenter.getPath()); }); } else { ScenarioSimulationEditorWrapper.super.populateDocks(identifier); } } ScenarioSimulationEditorBusinessCentralWrapper(); @Inject  ScenarioSimulationEditorBusinessCentralWrapper(final Caller<ScenarioSimulationService> service,
                                                          final ScenarioSimulationEditorPresenter scenarioSimulationEditorPresenter,
                                                          final ImportsWidgetPresenter importsWidget,
                                                          final AsyncPackageDataModelOracleFactory oracleFactory,
                                                          final PlaceManager placeManager,
                                                          final Caller<DMNTypeService> dmnTypeService,
                                                          final Caller<ImportExportService> importExportService,
                                                          final Caller<RunnerReportService> runnerReportService,
                                                          final ScenarioSimulationBusinessCentralDocksHandler scenarioSimulationBusinessCentralDocksHandler); @OnStartup void onStartup(final ObservablePath path,
                          final PlaceRequest place); @OnClose @Override void onClose(); @OnMayClose boolean mayClose(); @Override @WorkbenchPartTitle String getTitleText(); @Override @WorkbenchPartTitleDecoration IsWidget getTitle(); @Override @WorkbenchPartView IsWidget getWidget(); @Override @WorkbenchMenu void getMenus(final Consumer<Menus> menusConsumer); @Override void showDocks(); @Override void wrappedRegisterDock(String id, IsWidget widget); @Override void onImport(String fileContents, RemoteCallback<AbstractScesimModel> importCallBack, ErrorCallback<Object> importErrorCallback, AbstractScesimModel<? extends AbstractScesimData> scesimModel); @Override void onExportToCsv(RemoteCallback<String> exportCallBack, ScenarioSimulationHasBusyIndicatorDefaultErrorCallback scenarioSimulationHasBusyIndicatorDefaultErrorCallback, AbstractScesimModel<? extends AbstractScesimData> scesimModel); @Override void onDownloadReportToCsv(RemoteCallback<String> exportCallBack,
                                      ScenarioSimulationHasBusyIndicatorDefaultErrorCallback scenarioSimulationHasBusyIndicatorDefaultErrorCallback,
                                      SimulationRunMetadata simulationRunMetadata,
                                      ScenarioSimulationModel.Type modelType); @Override void hideDocks(); @Override void onRunScenario(RemoteCallback<SimulationRunResult> refreshModelCallback, ScenarioSimulationHasBusyIndicatorDefaultErrorCallback scenarioSimulationHasBusyIndicatorDefaultErrorCallback, ScesimModelDescriptor simulationDescriptor, Settings settings, List<ScenarioWithIndex> toRun, Background background); @Override Integer getOriginalHash(); @Override void addDownloadMenuItem(FileMenuBuilder fileMenuBuilder); @Override void validate(Simulation simulation, Settings settings, RemoteCallback<?> callback); @Override void onRefreshedModelContent(SimulationRunResult testResult); @Override void onEditTabSelected(); @Override void onOverviewSelected(); @Override void addBackgroundPage(final ScenarioGridWidget scenarioGridWidget); @Override void selectSimulationTab(); @Override void selectBackgroundTab(); @Override AbstractScenarioSimulationDocksHandler getScenarioSimulationDocksHandler(); @Override ScenarioSimulationEditorPresenter getScenarioSimulationEditorPresenter(); @Override void populateDocks(String identifier);  }
@Test(expected = IllegalArgumentException.class) public void populateRightDocks_Unknown() { scenarioSimulationEditorBusinessClientWrapper.populateDocks("Unknown"); verify(scenarioSimulationEditorPresenterMock, never()).setTestTools(any()); verify(coverageReportPresenterMock, never()).setCurrentPath(any()); verify(scenarioSimulationEditorPresenterMock, never()).setSettings(any()); verify(settingsPresenterMock, never()).setCurrentPath(any()); verify(cheatSheetPresenterMock, never()).setCurrentPath(any()); verify(scenarioSimulationEditorPresenterMock, never()).setCheatSheet(any()); }
@Test public void populateRightDocks_Settings() { doReturn(Optional.of(settingsPresenterMock)).when(scenarioSimulationBusinessCentralDocksHandlerMock).getSettingsPresenter(); scenarioSimulationEditorBusinessClientWrapper.populateDocks(SettingsPresenter.IDENTIFIER); verify(scenarioSimulationEditorPresenterMock, times(1)).setSettings(eq(settingsPresenterMock)); verify(settingsPresenterMock, times(1)).setCurrentPath(eq(pathMock)); verify(scenarioSimulationEditorPresenterMock, never()).setTestTools(any()); verify(coverageReportPresenterMock, never()).setCurrentPath(any()); verify(cheatSheetPresenterMock, never()).setCurrentPath(any()); verify(scenarioSimulationEditorPresenterMock, never()).setCheatSheet(any()); }
@Test public void populateRightDocks_TestTools() { doReturn(Optional.of(testToolsPresenterMock)).when(scenarioSimulationBusinessCentralDocksHandlerMock).getTestToolsPresenter(); scenarioSimulationEditorBusinessClientWrapper.populateDocks(TestToolsPresenter.IDENTIFIER); verify(scenarioSimulationEditorPresenterMock, times(1)).setTestTools(eq(testToolsPresenterMock)); verify(coverageReportPresenterMock, never()).setCurrentPath(any()); verify(scenarioSimulationEditorPresenterMock, never()).setSettings(any()); verify(settingsPresenterMock, never()).setCurrentPath(any()); verify(cheatSheetPresenterMock, never()).setCurrentPath(any()); verify(scenarioSimulationEditorPresenterMock, never()).setCheatSheet(any()); }