use of com.cloudogu.scm.review.pullrequest.service.PullRequestStatus.REJECTED in project scm-review-plugin by scm-manager.
the class PullRequestRootResourceTest method shouldSetPullRequestToStatusRejected.
@Test
public void shouldSetPullRequestToStatusRejected() throws URISyntaxException {
Subject subject = mock(Subject.class, RETURNS_DEEP_STUBS);
shiroRule.setSubject(subject);
User currentUser = new User("currentUser");
when(subject.getPrincipals().oneByType(User.class)).thenReturn(currentUser);
when(store.get("1")).thenReturn(createPullRequest("opened_1", PullRequestStatus.OPEN));
when(branchResolver.resolve(any(), any())).thenReturn(Branch.normalBranch("master", "123"));
MockHttpRequest request = MockHttpRequest.post("/" + PullRequestRootResource.PULL_REQUESTS_PATH_V2 + "/ns/repo/1/reject");
dispatcher.invoke(request, response);
assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_NO_CONTENT);
verify(store).update(argThat(pullRequest -> {
assertThat(pullRequest.getStatus()).isEqualTo(REJECTED);
return true;
}));
}
Aggregations