### Question:
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();  }### Answer:
@Test public void testShowSaveModal() { doReturn(promises.resolve(true)).when(projectController).canUpdateProject(any()); doReturn(promises.resolve()).when(sectionManager).validateAll(); presenter.showSaveModal(); verify(savePopUpPresenter).show(any()); verify(sectionManager, never()).goTo(any()); }
@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()); }
@Test public void testShowSaveModalWithValidationError() { doReturn(promises.resolve(true)).when(projectController).canUpdateProject(any()); Section<ProjectScreenModel> section = newMockedSection(); doReturn(promises.reject(section)).when(sectionManager).validateAll(); presenter.showSaveModal(); verify(savePopUpPresenter, never()).show(any()); verify(view).hideBusyIndicator(); verify(sectionManager).goTo(section); }