@Test public void setupSectionTest() { final Section<SpaceScreenModel> section = createSectionMock(); doReturn(promises.resolve()).when(section).setup(any()); presenter.setupSection(mock(SpaceScreenModel.class), section).catch_(i -> { fail("Promise should've been resolved!"); return promises.resolve(); }); verify(section).setup(any()); verify(sectionManager).resetDirtyIndicator(section); verify(notificationEvent, never()).fire(any()); }
Promise<Object> setupSection(final SpaceScreenModel model, final Section<SpaceScreenModel> section) { return section.setup(model) .then(i -> { sectionManager.resetDirtyIndicator(section); return promises.resolve(); }).catch_(e -> { sectionManager.remove(section); notificationEvent.fire(new NotificationEvent(getSectionSetupErrorMessage(section), WARNING)); return promises.resolve(); }); }
SettingsScreenPresenter implements HasBusyIndicator { Promise<Object> setupSection(final SpaceScreenModel model, final Section<SpaceScreenModel> section) { return section.setup(model) .then(i -> { sectionManager.resetDirtyIndicator(section); return promises.resolve(); }).catch_(e -> { sectionManager.remove(section); notificationEvent.fire(new NotificationEvent(getSectionSetupErrorMessage(section), WARNING)); return promises.resolve(); }); } }
SettingsScreenPresenter implements HasBusyIndicator { Promise<Object> setupSection(final SpaceScreenModel model, final Section<SpaceScreenModel> section) { return section.setup(model) .then(i -> { sectionManager.resetDirtyIndicator(section); return promises.resolve(); }).catch_(e -> { sectionManager.remove(section); notificationEvent.fire(new NotificationEvent(getSectionSetupErrorMessage(section), WARNING)); return promises.resolve(); }); } @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 { Promise<Object> setupSection(final SpaceScreenModel model, final Section<SpaceScreenModel> section) { return section.setup(model) .then(i -> { sectionManager.resetDirtyIndicator(section); return promises.resolve(); }).catch_(e -> { sectionManager.remove(section); notificationEvent.fire(new NotificationEvent(getSectionSetupErrorMessage(section), WARNING)); return promises.resolve(); }); } @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 { Promise<Object> setupSection(final SpaceScreenModel model, final Section<SpaceScreenModel> section) { return section.setup(model) .then(i -> { sectionManager.resetDirtyIndicator(section); return promises.resolve(); }).catch_(e -> { sectionManager.remove(section); notificationEvent.fire(new NotificationEvent(getSectionSetupErrorMessage(section), WARNING)); return promises.resolve(); }); } @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();  }