### Question:
GeneralSettingsPresenter extends Section<ProjectScreenModel> { Promise<Object> showErrorAndReject(final Object o) { return promises.catchOrExecute(o, e -> { view.showError(e.getMessage()); return promises.reject(this); }, (final String errorMessage) -> { view.showError(errorMessage); return promises.reject(this); }); } @Inject  GeneralSettingsPresenter(final View view,
                                    final Promises promises,
                                    final MenuItem<ProjectScreenModel> menuItem,
                                    final Caller<ValidationService> validationService,
                                    final Caller<WorkspaceProjectService> projectService,
                                    final Event<SettingsSectionChange<ProjectScreenModel>> settingsSectionChangeEvent,
                                    final GAVPreferences gavPreferences,
                                    final ProjectScopedResolutionStrategySupplier projectScopedResolutionStrategySupplier,
                                    final GitUrlsPresenter gitUrlsPresenter,
                                    final LibraryPlaces libraryPlaces); @Override Promise<Void> setup(final ProjectScreenModel model); @Override Promise<Object> validate(); @Override Promise<Void> save(final String comment,
                              final Supplier<Promise<Void>> chain); @Override int currentHashCode(); GitUrlsPresenter getGitUrlsPresenter(); @Override SectionView<?> getView();  }### Answer:
@Test public void testShowErrorAndRejectWithException() { final RuntimeException testException = new RuntimeException("Test message"); doNothing().when(view).showError(any()); generalSettingsPresenter.showErrorAndReject(testException).then(i -> { Assert.fail("Promise should've not been resolved!"); return promises.resolve(); }).catch_(e -> { verify(view).showError(eq("Test message")); Assert.assertEquals(e, generalSettingsPresenter); return promises.resolve(); }); }
@Test public void testShowErrorAndRejectWithRejection() { generalSettingsPresenter.showErrorAndReject("Test message").then(i -> { Assert.fail("Promise should've not been resolved!"); return promises.resolve(); }).catch_(e -> { verify(view).showError(eq("Test message")); Assert.assertEquals(e, generalSettingsPresenter); return promises.resolve(); }); }