@Test public void getValidationCallback() { presenterSpy.getValidationCallback().callback(null); verify(confirmPopupPresenterMock, never()).show(anyString(), anyString()); List<FactMappingValidationError> validationErrors = new ArrayList<>(); presenterSpy.getValidationCallback().callback(validationErrors); verify(confirmPopupPresenterMock, never()).show(anyString(), anyString()); String errorMessage = "errorMessage"; String errorId = "errorId"; validationErrors.add(new FactMappingValidationError(errorId, errorMessage)); presenterSpy.getValidationCallback().callback(validationErrors); verify(confirmPopupPresenterMock, times(1)).show(anyString(), contains(errorId)); verify(confirmPopupPresenterMock, times(1)).show(anyString(), contains(errorMessage)); }
protected RemoteCallback<List<FactMappingValidationError>> getValidationCallback() { return result -> { view.hideBusyIndicator(); if (result != null && !result.isEmpty()) { StringBuilder errorMessage = new StringBuilder(ScenarioSimulationEditorConstants.INSTANCE.validationErrorMessage()); errorMessage.append(":<br/>"); for (FactMappingValidationError validationError : result) { errorMessage.append("<b>"); errorMessage.append(validationError.getErrorId()); errorMessage.append("</b> - "); errorMessage.append(validationError.getErrorMessage()); errorMessage.append("<br/>"); } confirmPopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.validationErrorTitle(), errorMessage.toString()); } else { sendNotification(ScenarioSimulationEditorConstants.INSTANCE.validationSucceed(), NotificationEvent.NotificationType.SUCCESS); } }; }
ScenarioSimulationEditorPresenter { protected RemoteCallback<List<FactMappingValidationError>> getValidationCallback() { return result -> { view.hideBusyIndicator(); if (result != null && !result.isEmpty()) { StringBuilder errorMessage = new StringBuilder(ScenarioSimulationEditorConstants.INSTANCE.validationErrorMessage()); errorMessage.append(":<br/>"); for (FactMappingValidationError validationError : result) { errorMessage.append("<b>"); errorMessage.append(validationError.getErrorId()); errorMessage.append("</b> - "); errorMessage.append(validationError.getErrorMessage()); errorMessage.append("<br/>"); } confirmPopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.validationErrorTitle(), errorMessage.toString()); } else { sendNotification(ScenarioSimulationEditorConstants.INSTANCE.validationSucceed(), NotificationEvent.NotificationType.SUCCESS); } }; } }
ScenarioSimulationEditorPresenter { protected RemoteCallback<List<FactMappingValidationError>> getValidationCallback() { return result -> { view.hideBusyIndicator(); if (result != null && !result.isEmpty()) { StringBuilder errorMessage = new StringBuilder(ScenarioSimulationEditorConstants.INSTANCE.validationErrorMessage()); errorMessage.append(":<br/>"); for (FactMappingValidationError validationError : result) { errorMessage.append("<b>"); errorMessage.append(validationError.getErrorId()); errorMessage.append("</b> - "); errorMessage.append(validationError.getErrorMessage()); errorMessage.append("<br/>"); } confirmPopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.validationErrorTitle(), errorMessage.toString()); } else { sendNotification(ScenarioSimulationEditorConstants.INSTANCE.validationSucceed(), NotificationEvent.NotificationType.SUCCESS); } }; } ScenarioSimulationEditorPresenter(); @Inject  ScenarioSimulationEditorPresenter(final AbstractScenarioSimulationProducer abstractScenarioSimulationProducer,
                                             final ScenarioSimulationResourceType type,
                                             final PlaceManager placeManager,
                                             final AbstractScenarioSimulationDocksHandler abstractScenarioSimulationDocksHandler,
                                             final TextFileExport textFileExport,
                                             final ConfirmPopupPresenter confirmPopupPresenter); }
ScenarioSimulationEditorPresenter { protected RemoteCallback<List<FactMappingValidationError>> getValidationCallback() { return result -> { view.hideBusyIndicator(); if (result != null && !result.isEmpty()) { StringBuilder errorMessage = new StringBuilder(ScenarioSimulationEditorConstants.INSTANCE.validationErrorMessage()); errorMessage.append(":<br/>"); for (FactMappingValidationError validationError : result) { errorMessage.append("<b>"); errorMessage.append(validationError.getErrorId()); errorMessage.append("</b> - "); errorMessage.append(validationError.getErrorMessage()); errorMessage.append("<br/>"); } confirmPopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.validationErrorTitle(), errorMessage.toString()); } else { sendNotification(ScenarioSimulationEditorConstants.INSTANCE.validationSucceed(), NotificationEvent.NotificationType.SUCCESS); } }; } ScenarioSimulationEditorPresenter(); @Inject  ScenarioSimulationEditorPresenter(final AbstractScenarioSimulationProducer abstractScenarioSimulationProducer,
                                             final ScenarioSimulationResourceType type,
                                             final PlaceManager placeManager,
                                             final AbstractScenarioSimulationDocksHandler abstractScenarioSimulationDocksHandler,
                                             final TextFileExport textFileExport,
                                             final ConfirmPopupPresenter confirmPopupPresenter); void setWrapper(ScenarioSimulationEditorWrapper scenarioSimulationEditorWrapper); void setPath(ObservablePath path); ObservablePath getPath(); void setPackageName(String packageName); void onClose(); void showDocks(PlaceStatus status); void hideDocks(); void onUberfireDocksInteractionEvent(@Observes final UberfireDocksInteractionEvent uberfireDocksInteractionEvent); void expandToolsDock(); ScenarioSimulationView getView(); ScenarioSimulationModel getModel(); Command getPopulateTestToolsCommand(); void reloadTestTools(boolean disable); void onRunScenario(); void onRunScenario(List<Integer> indexOfScenarioToRun); void onUndo(); void onRedo(); void setUndoButtonEnabledStatus(boolean enabled); void setRedoButtonEnabledStatus(boolean enabled); void setItemMenuEnabled(boolean enabled); void addDownloadMenuItem(FileMenuBuilder fileMenuBuilder, Supplier<Path> pathSupplier); DataManagementStrategy getDataManagementStrategy(); void onImport(String fileContents, GridWidget gridWidget); EventBus getEventBus(); ScenarioSimulationContext getContext(); void sendNotification(String text, NotificationEvent.NotificationType type); void sendNotification(String text, NotificationEvent.NotificationType type, boolean autoHide); void makeMenuBar(FileMenuBuilder fileMenuBuilder); void addCommonActions(final FileMenuBuilder fileMenuBuilder, MenuItem versionMenuItem, MenuItem alertsButtonMenuItem); void loadContent(); boolean isDirty(); void onEditTabSelected(); void onBackgroundTabSelected(); void onOverviewSelected(); void onImportsTabSelected(); void validateSimulation(); void selectSimulationTab(); void selectBackgroundTab(); RemoteCallback<String> getExportCallBack(); ErrorCallback<Boolean> getValidationFailedCallback(); void populateRightDocks(String identifier); void getModelSuccessCallbackMethod(DataManagementStrategy dataManagementStrategy, ScenarioSimulationModel model); ScenarioSimulationResourceType getType(); void setTestTools(TestToolsView.Presenter presenter); void setCheatSheet(CheatSheetView.Presenter presenter); void setSettings(SettingsView.Presenter presenter); String getJsonModel(ScenarioSimulationModel model); }
ScenarioSimulationEditorPresenter { protected RemoteCallback<List<FactMappingValidationError>> getValidationCallback() { return result -> { view.hideBusyIndicator(); if (result != null && !result.isEmpty()) { StringBuilder errorMessage = new StringBuilder(ScenarioSimulationEditorConstants.INSTANCE.validationErrorMessage()); errorMessage.append(":<br/>"); for (FactMappingValidationError validationError : result) { errorMessage.append("<b>"); errorMessage.append(validationError.getErrorId()); errorMessage.append("</b> - "); errorMessage.append(validationError.getErrorMessage()); errorMessage.append("<br/>"); } confirmPopupPresenter.show(ScenarioSimulationEditorConstants.INSTANCE.validationErrorTitle(), errorMessage.toString()); } else { sendNotification(ScenarioSimulationEditorConstants.INSTANCE.validationSucceed(), NotificationEvent.NotificationType.SUCCESS); } }; } ScenarioSimulationEditorPresenter(); @Inject  ScenarioSimulationEditorPresenter(final AbstractScenarioSimulationProducer abstractScenarioSimulationProducer,
                                             final ScenarioSimulationResourceType type,
                                             final PlaceManager placeManager,
                                             final AbstractScenarioSimulationDocksHandler abstractScenarioSimulationDocksHandler,
                                             final TextFileExport textFileExport,
                                             final ConfirmPopupPresenter confirmPopupPresenter); void setWrapper(ScenarioSimulationEditorWrapper scenarioSimulationEditorWrapper); void setPath(ObservablePath path); ObservablePath getPath(); void setPackageName(String packageName); void onClose(); void showDocks(PlaceStatus status); void hideDocks(); void onUberfireDocksInteractionEvent(@Observes final UberfireDocksInteractionEvent uberfireDocksInteractionEvent); void expandToolsDock(); ScenarioSimulationView getView(); ScenarioSimulationModel getModel(); Command getPopulateTestToolsCommand(); void reloadTestTools(boolean disable); void onRunScenario(); void onRunScenario(List<Integer> indexOfScenarioToRun); void onUndo(); void onRedo(); void setUndoButtonEnabledStatus(boolean enabled); void setRedoButtonEnabledStatus(boolean enabled); void setItemMenuEnabled(boolean enabled); void addDownloadMenuItem(FileMenuBuilder fileMenuBuilder, Supplier<Path> pathSupplier); DataManagementStrategy getDataManagementStrategy(); void onImport(String fileContents, GridWidget gridWidget); EventBus getEventBus(); ScenarioSimulationContext getContext(); void sendNotification(String text, NotificationEvent.NotificationType type); void sendNotification(String text, NotificationEvent.NotificationType type, boolean autoHide); void makeMenuBar(FileMenuBuilder fileMenuBuilder); void addCommonActions(final FileMenuBuilder fileMenuBuilder, MenuItem versionMenuItem, MenuItem alertsButtonMenuItem); void loadContent(); boolean isDirty(); void onEditTabSelected(); void onBackgroundTabSelected(); void onOverviewSelected(); void onImportsTabSelected(); void validateSimulation(); void selectSimulationTab(); void selectBackgroundTab(); RemoteCallback<String> getExportCallBack(); ErrorCallback<Boolean> getValidationFailedCallback(); void populateRightDocks(String identifier); void getModelSuccessCallbackMethod(DataManagementStrategy dataManagementStrategy, ScenarioSimulationModel model); ScenarioSimulationResourceType getType(); void setTestTools(TestToolsView.Presenter presenter); void setCheatSheet(CheatSheetView.Presenter presenter); void setSettings(SettingsView.Presenter presenter); String getJsonModel(ScenarioSimulationModel model); static final String IDENTIFIER; }