@Test public void testSetupSection() { final Section<ProjectScreenModel> section = newMockedSection(); doReturn(promises.resolve()).when(section).setup(any()); presenter.setupSection(mock(ProjectScreenModel.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 ProjectScreenModel model, final Section<ProjectScreenModel> 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(); }); }
SettingsPresenter { Promise<Object> setupSection(final ProjectScreenModel model, final Section<ProjectScreenModel> 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(); }); } }
SettingsPresenter { Promise<Object> setupSection(final ProjectScreenModel model, final Section<ProjectScreenModel> 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  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 { Promise<Object> setupSection(final ProjectScreenModel model, final Section<ProjectScreenModel> 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  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 { Promise<Object> setupSection(final ProjectScreenModel model, final Section<ProjectScreenModel> 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  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();  }