public void testSaveWithCommitMessageOnSuccess() { tested.save(SAVE_MESSAGE); verify(view).showSaving(); verify(projectDiagramServices).saveOrUpdate(eq(path), any(ProjectDiagram.class), any(Metadata.class), eq(SAVE_MESSAGE), serviceCallbackCaptor.capture()); final ServiceCallback<ProjectDiagram> serviceCallback = serviceCallbackCaptor.getValue(); final ProjectDiagram diagram = mock(ProjectDiagram.class); serviceCallback.onSuccess(diagram); verify(view).hideBusyIndicator(); verify(versionRecordManager).reloadVersions(eq(path)); verify(presenterView).showMessage(StunnerProjectClientConstants.DIAGRAM_SAVE_SUCCESSFUL); }
public void testSaveWithCommitMessageOnError() { tested.save(SAVE_MESSAGE); verify(view).showSaving(); verify(projectDiagramServices).saveOrUpdate(eq(path), any(ProjectDiagram.class), any(Metadata.class), eq(SAVE_MESSAGE), serviceCallbackCaptor.capture()); final ServiceCallback<ProjectDiagram> serviceCallback = serviceCallbackCaptor.getValue(); final ClientRuntimeError error = mock(ClientRuntimeError.class); serviceCallback.onError(error); verify(diagramClientErrorHandler).handleError(eq(error), consumerCaptor.capture()); final Consumer<String> consumer = consumerCaptor.getValue(); consumer.accept(ERROR_MESSAGE); verify(errorPopupPresenter).showMessage(ERROR_MESSAGE); }
@SuppressWarnings("unchecked") private ServiceCallback<String> assertBasicXMLSaveOperation(final String xml) { final String commitMessage = "message"; final Overview overview = openInvalidBPMNFile(xml); final Metadata metadata = overview.getMetadata(); EditorSessionCommands editorSessionCommands = mock(EditorSessionCommands.class); when(getMenuSessionItems().getCommands()).thenReturn(editorSessionCommands); ValidateSessionCommand validateSessionCommand = mock(ValidateSessionCommand.class); when(editorSessionCommands.getValidateSessionCommand()).thenReturn(validateSessionCommand); doAnswer(invocation -> { ClientSessionCommand.Callback callback = (ClientSessionCommand.Callback) invocation.getArguments()[0]; callback.onSuccess(); return null; }).when(validateSessionCommand).execute(any(ClientSessionCommand.Callback.class)); doReturn(xml).when(xmlEditorView).getContent(); presenter.save(); ArgumentCaptor<ParameterizedCommand> savePopupCommandCaptor = ArgumentCaptor.forClass(ParameterizedCommand.class); verify(savePopUpPresenter).show(eq(versionRecordManager.getCurrentPath()), savePopupCommandCaptor.capture()); final ParameterizedCommand<String> savePopupCommand = savePopupCommandCaptor.getValue(); savePopupCommand.execute(commitMessage); verify(view).showSaving(); ArgumentCaptor<ServiceCallback> serviceCallbackCaptor = ArgumentCaptor.forClass(ServiceCallback.class); verify(clientProjectDiagramService).saveAsXml(eq(versionRecordManager.getCurrentPath()), eq(xml), eq(metadata), eq(commitMessage), serviceCallbackCaptor.capture()); return serviceCallbackCaptor.getValue(); }
savePopupCommand.execute(commitMessage); verify(view).showSaving(); ArgumentCaptor<ServiceCallback> serviceCallbackCaptor = ArgumentCaptor.forClass(ServiceCallback.class); verify(clientProjectDiagramService).saveOrUpdate(eq(versionRecordManager.getCurrentPath()),
protected void showSavingViews() { getView().showSaving(); }
@Test public void testShowSavingViews() { tested.showSavingViews(); verify(view).showSaving(); }