### Question:
ChangeRequestReviewScreenPresenter { public void reject() { this.doActionIfAllowed(this::rejectChangeRequestAction); } @Inject  ChangeRequestReviewScreenPresenter(final View view,
                                              final TranslationService ts,
                                              final LibraryPlaces libraryPlaces,
                                              final Caller<ChangeRequestService> changeRequestService,
                                              final Caller<RepositoryService> repositoryService,
                                              final BusyIndicatorView busyIndicatorView,
                                              final OverviewScreenPresenter overviewScreen,
                                              final ChangedFilesScreenPresenter changedFilesScreen,
                                              final Promises promises,
                                              final ProjectController projectController,
                                              final Event<NotificationEvent> notificationEvent,
                                              final SessionInfo sessionInfo,
                                              final SquashChangeRequestPopUpPresenter squashChangeRequestPopUpPresenter); @PostConstruct void postConstruct(); void refreshOnFocus(@Observes final SelectPlaceEvent selectPlaceEvent); void onChangeRequestUpdated(@Observes final ChangeRequestUpdatedEvent event); void onChangeRequestStatusUpdated(@Observes final ChangeRequestStatusUpdatedEvent event); void onRepositoryFileListUpdated(@Observes final RepositoryFileListUpdatedEvent event); void onRepositoryUpdated(@Observes final RepositoryUpdatedEvent event); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView View getView(); void showOverviewContent(); void showChangedFilesContent(); void cancel(); void reject(); void squash(); void merge(); void revert(); void close(); void reopen();  }### Answer:
@Test public void rejectWhenHasPermissionTest() throws NoSuchFieldException { new FieldSetter(presenter, ChangeRequestReviewScreenPresenter.class.getDeclaredField("workspaceProject")) .set(workspaceProject); new FieldSetter(presenter, ChangeRequestReviewScreenPresenter.class.getDeclaredField("repository")) .set(repository); new FieldSetter(presenter, ChangeRequestReviewScreenPresenter.class.getDeclaredField("currentTargetBranch")) .set(branch); doReturn(promises.resolve(true)).when(projectController) .canUpdateBranch(workspaceProject, branch); presenter.reject(); verify(changeRequestService).rejectChangeRequest(anyString(), anyString(), anyLong()); verify(notificationEvent).fire(any(NotificationEvent.class)); }
@Test public void rejectWhenNotAllowedTest() throws NoSuchFieldException { new FieldSetter(presenter, ChangeRequestReviewScreenPresenter.class.getDeclaredField("workspaceProject")) .set(workspaceProject); new FieldSetter(presenter, ChangeRequestReviewScreenPresenter.class.getDeclaredField("currentTargetBranch")) .set(branch); doReturn(promises.resolve(false)).when(projectController) .canUpdateBranch(workspaceProject, branch); presenter.reject(); verify(changeRequestService, never()).rejectChangeRequest(anyString(), anyString(), anyLong()); }