@Test public void saveWhenNotAllowedTest() { doReturn(false).when(organizationalUnitController).canUpdateOrgUnit(organizationalUnit); doReturn(promises.resolve()).when(sectionManager).validateAll(); presenter.save(); verify(sectionManager, never()).goTo(any()); }
public void save() { if (canUpdate()) { sectionManager.validateAll().then(i -> { save(""); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { hideBusyIndicator(); return promises.reject(e); }, (final Section<SpaceScreenModel> section) -> { hideBusyIndicator(); return sectionManager.goTo(section); })); } }
SettingsScreenPresenter implements HasBusyIndicator { public void save() { if (canUpdate()) { sectionManager.validateAll().then(i -> { save(""); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { hideBusyIndicator(); return promises.reject(e); }, (final Section<SpaceScreenModel> section) -> { hideBusyIndicator(); return sectionManager.goTo(section); })); } } }
SettingsScreenPresenter implements HasBusyIndicator { public void save() { if (canUpdate()) { sectionManager.validateAll().then(i -> { save(""); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { hideBusyIndicator(); return promises.reject(e); }, (final Section<SpaceScreenModel> section) -> { hideBusyIndicator(); return sectionManager.goTo(section); })); } } @Inject  SettingsScreenPresenter(final View view,
                                   final TranslationService ts,
                                   final OrganizationalUnitController organizationalUnitController,
                                   final WorkspaceProjectContext projectContext,
                                   final BusyIndicatorView busyIndicatorView,
                                   final SectionManager<SpaceScreenModel> sectionManager,
                                   final @SpaceSettings SettingsSections settingsSections,
                                   final Promises promises,
                                   final Event<NotificationEvent> notificationEvent); }
SettingsScreenPresenter implements HasBusyIndicator { public void save() { if (canUpdate()) { sectionManager.validateAll().then(i -> { save(""); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { hideBusyIndicator(); return promises.reject(e); }, (final Section<SpaceScreenModel> section) -> { hideBusyIndicator(); return sectionManager.goTo(section); })); } } @Inject  SettingsScreenPresenter(final View view,
                                   final TranslationService ts,
                                   final OrganizationalUnitController organizationalUnitController,
                                   final WorkspaceProjectContext projectContext,
                                   final BusyIndicatorView busyIndicatorView,
                                   final SectionManager<SpaceScreenModel> sectionManager,
                                   final @SpaceSettings SettingsSections settingsSections,
                                   final Promises promises,
                                   final Event<NotificationEvent> notificationEvent); @PostConstruct void postConstruct(); Promise<Void> setupUsingCurrentSection(); View getView(); @Override void showBusyIndicator(final String message); @Override void hideBusyIndicator(); void onSettingsSectionChanged(@Observes final SettingsSectionChange<SpaceScreenModel> settingsSectionChange); void save(); void reset(); }
SettingsScreenPresenter implements HasBusyIndicator { public void save() { if (canUpdate()) { sectionManager.validateAll().then(i -> { save(""); return promises.resolve(); }).catch_(o -> promises.catchOrExecute(o, e -> { hideBusyIndicator(); return promises.reject(e); }, (final Section<SpaceScreenModel> section) -> { hideBusyIndicator(); return sectionManager.goTo(section); })); } } @Inject  SettingsScreenPresenter(final View view,
                                   final TranslationService ts,
                                   final OrganizationalUnitController organizationalUnitController,
                                   final WorkspaceProjectContext projectContext,
                                   final BusyIndicatorView busyIndicatorView,
                                   final SectionManager<SpaceScreenModel> sectionManager,
                                   final @SpaceSettings SettingsSections settingsSections,
                                   final Promises promises,
                                   final Event<NotificationEvent> notificationEvent); @PostConstruct void postConstruct(); Promise<Void> setupUsingCurrentSection(); View getView(); @Override void showBusyIndicator(final String message); @Override void hideBusyIndicator(); void onSettingsSectionChanged(@Observes final SettingsSectionChange<SpaceScreenModel> settingsSectionChange); void save(); void reset();  }