Search in sources :

Example 81 with PullRequest

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

the class AllReviewerApprovedRuleTest method shouldReturnFailedIfSingleReviewerHasNotApproved.

@Test
void shouldReturnFailedIfSingleReviewerHasNotApproved() {
    PullRequest pullRequest = TestData.createPullRequest();
    pullRequest.addApprover("trillian");
    pullRequest.addReviewer("dent");
    Context context = new Context(REPOSITORY, pullRequest);
    Result result = rule.validate(context);
    assertThat(result.isFailed()).isTrue();
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Test(org.junit.jupiter.api.Test)

Example 82 with PullRequest

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

the class AllReviewerApprovedRuleTest method shouldReturnSuccessWithoutReviewers.

@Test
void shouldReturnSuccessWithoutReviewers() {
    PullRequest pullRequest = TestData.createPullRequest();
    Context context = new Context(REPOSITORY, pullRequest);
    Result result = rule.validate(context);
    assertThat(result.isSuccess()).isTrue();
}
Also used : PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) Test(org.junit.jupiter.api.Test)

Aggregations

PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)82 Repository (sonia.scm.repository.Repository)27 Test (org.junit.jupiter.api.Test)20 Test (org.junit.Test)18 TestData.createPullRequest (com.cloudogu.scm.review.TestData.createPullRequest)17 MockHttpRequest (org.jboss.resteasy.mock.MockHttpRequest)16 Subscribe (com.github.legman.Subscribe)13 SubjectAware (com.github.sdorra.shiro.SubjectAware)13 NamespaceAndName (sonia.scm.repository.NamespaceAndName)13 User (sonia.scm.user.User)11 DisplayUser (sonia.scm.user.DisplayUser)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 Optional (java.util.Optional)7 Comment (com.cloudogu.scm.review.comment.service.Comment)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 PermissionCheck (com.cloudogu.scm.review.PermissionCheck)5 PullRequestService (com.cloudogu.scm.review.pullrequest.service.PullRequestService)5 Operation (io.swagger.v3.oas.annotations.Operation)5 List (java.util.List)5