@Test public void testShowSaveModalWithoutPermission() { doReturn(promises.resolve(false)).when(projectController).canUpdateProject(any()); doReturn(promises.resolve()).when(sectionManager).validateAll(); presenter.showSaveModal(); verify(savePopUpPresenter, never()).show(any()); verify(sectionManager, never()).goTo(any()); }
public void showSaveModal() { projectController.canUpdateProject(projectContext.getActiveWorkspaceProject().get()).then(userCanUpdateProject -> { if (userCanUpdateProject) { sectionManager.validateAll().then(i -> { savePopUpPresenter.show(this::save); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { view.hideBusyIndicator(); return promises.reject(e); }, (final Section<ProjectScreenModel> section) -> { view.hideBusyIndicator(); return sectionManager.goTo(section); })); } return promises.resolve(); }); }
SettingsPresenter { public void showSaveModal() { projectController.canUpdateProject(projectContext.getActiveWorkspaceProject().get()).then(userCanUpdateProject -> { if (userCanUpdateProject) { sectionManager.validateAll().then(i -> { savePopUpPresenter.show(this::save); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { view.hideBusyIndicator(); return promises.reject(e); }, (final Section<ProjectScreenModel> section) -> { view.hideBusyIndicator(); return sectionManager.goTo(section); })); } return promises.resolve(); }); } }
SettingsPresenter { public void showSaveModal() { projectController.canUpdateProject(projectContext.getActiveWorkspaceProject().get()).then(userCanUpdateProject -> { if (userCanUpdateProject) { sectionManager.validateAll().then(i -> { savePopUpPresenter.show(this::save); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { view.hideBusyIndicator(); return promises.reject(e); }, (final Section<ProjectScreenModel> section) -> { view.hideBusyIndicator(); return sectionManager.goTo(section); })); } return promises.resolve(); }); } @Inject  SettingsPresenter(final View view,
                             final Promises promises,
                             final Event<NotificationEvent> notificationEvent,
                             final @Customizable SettingsSections<ProjectScreenModel> settingsSections,
                             final SavePopUpPresenter savePopUpPresenter,
                             final Caller<ProjectScreenService> projectScreenService,
                             final WorkspaceProjectContext projectContext,
                             final ManagedInstance<ObservablePath> observablePaths,
                             final ConflictingRepositoriesPopup conflictingRepositoriesPopup,
                             final SectionManager<ProjectScreenModel> sectionManager,
                             final ProjectController projectController); }
SettingsPresenter { public void showSaveModal() { projectController.canUpdateProject(projectContext.getActiveWorkspaceProject().get()).then(userCanUpdateProject -> { if (userCanUpdateProject) { sectionManager.validateAll().then(i -> { savePopUpPresenter.show(this::save); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { view.hideBusyIndicator(); return promises.reject(e); }, (final Section<ProjectScreenModel> section) -> { view.hideBusyIndicator(); return sectionManager.goTo(section); })); } return promises.resolve(); }); } @Inject  SettingsPresenter(final View view,
                             final Promises promises,
                             final Event<NotificationEvent> notificationEvent,
                             final @Customizable SettingsSections<ProjectScreenModel> settingsSections,
                             final SavePopUpPresenter savePopUpPresenter,
                             final Caller<ProjectScreenService> projectScreenService,
                             final WorkspaceProjectContext projectContext,
                             final ManagedInstance<ObservablePath> observablePaths,
                             final ConflictingRepositoriesPopup conflictingRepositoriesPopup,
                             final SectionManager<ProjectScreenModel> sectionManager,
                             final ProjectController projectController); @PostConstruct void setup(); Promise<Void> setupUsingCurrentSection(); void showSaveModal(); void onSettingsSectionChanged(@Observes final SettingsSectionChange<ProjectScreenModel> settingsSectionChange); boolean mayClose(); void reset(); View getView(); }
SettingsPresenter { public void showSaveModal() { projectController.canUpdateProject(projectContext.getActiveWorkspaceProject().get()).then(userCanUpdateProject -> { if (userCanUpdateProject) { sectionManager.validateAll().then(i -> { savePopUpPresenter.show(this::save); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { view.hideBusyIndicator(); return promises.reject(e); }, (final Section<ProjectScreenModel> section) -> { view.hideBusyIndicator(); return sectionManager.goTo(section); })); } return promises.resolve(); }); } @Inject  SettingsPresenter(final View view,
                             final Promises promises,
                             final Event<NotificationEvent> notificationEvent,
                             final @Customizable SettingsSections<ProjectScreenModel> settingsSections,
                             final SavePopUpPresenter savePopUpPresenter,
                             final Caller<ProjectScreenService> projectScreenService,
                             final WorkspaceProjectContext projectContext,
                             final ManagedInstance<ObservablePath> observablePaths,
                             final ConflictingRepositoriesPopup conflictingRepositoriesPopup,
                             final SectionManager<ProjectScreenModel> sectionManager,
                             final ProjectController projectController); @PostConstruct void setup(); Promise<Void> setupUsingCurrentSection(); void showSaveModal(); void onSettingsSectionChanged(@Observes final SettingsSectionChange<ProjectScreenModel> settingsSectionChange); boolean mayClose(); void reset(); View getView();  }