@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();
}