Search in sources :

Example 1 with ReviewMark

use of com.cloudogu.scm.review.pullrequest.service.ReviewMark in project scm-review-plugin by scm-manager.

the class PullRequestRootResourceTest method shouldGetMarkedAsReviewedPaths.

@Test
@SubjectAware(username = "dent")
public void shouldGetMarkedAsReviewedPaths() throws URISyntaxException, IOException {
    mockLoggedInUser(new User("dent"));
    PullRequest pullRequest = createPullRequest();
    pullRequest.setAuthor("slarti");
    pullRequest.setReviewMarks(ImmutableSet.of(new ReviewMark("/some/file", "dent"), new ReviewMark("/some/other/file", "trillian")));
    when(store.get("1")).thenReturn(pullRequest);
    MockHttpRequest request = MockHttpRequest.get("/" + PullRequestRootResource.PULL_REQUESTS_PATH_V2 + "/ns/repo/1");
    dispatcher.invoke(request, response);
    assertThat(response.getStatus()).isEqualTo(200);
    assertThat(response.getContentAsString()).contains("\"markedAsReviewed\":[\"/some/file\"]");
}
Also used : MockHttpRequest(org.jboss.resteasy.mock.MockHttpRequest) DisplayUser(sonia.scm.user.DisplayUser) User(sonia.scm.user.User) PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) TestData.createPullRequest(com.cloudogu.scm.review.TestData.createPullRequest) ReviewMark(com.cloudogu.scm.review.pullrequest.service.ReviewMark) Test(org.junit.Test) SubjectAware(com.github.sdorra.shiro.SubjectAware)

Aggregations

TestData.createPullRequest (com.cloudogu.scm.review.TestData.createPullRequest)1 PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)1 ReviewMark (com.cloudogu.scm.review.pullrequest.service.ReviewMark)1 SubjectAware (com.github.sdorra.shiro.SubjectAware)1 MockHttpRequest (org.jboss.resteasy.mock.MockHttpRequest)1 Test (org.junit.Test)1 DisplayUser (sonia.scm.user.DisplayUser)1 User (sonia.scm.user.User)1