use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class CommentServiceTest method shouldAddCommentOnRejectEventByDeletedBranch.
@Test
@SubjectAware(username = "dent")
public void shouldAddCommentOnRejectEventByDeletedBranch() {
PullRequest pullRequest = mockPullRequest();
when(store.add(eq(PULL_REQUEST_ID), rootCommentCaptor.capture())).thenReturn("newId");
commentService.addCommentOnReject(new PullRequestRejectedEvent(REPOSITORY, pullRequest, PullRequestRejectedEvent.RejectionCause.BRANCH_DELETED));
assertThat(rootCommentCaptor.getAllValues()).hasSize(1);
Comment storedComment = rootCommentCaptor.getValue();
assertThat(storedComment.getComment()).isEqualTo("sourceDeleted");
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class EventListenerTest method createReplyEvent.
private ReplyEvent createReplyEvent() {
Repository repository = RepositoryTestData.createHeartOfGold();
PullRequest pullRequest = TestData.createPullRequest();
mockChannel(repository, pullRequest);
Reply reply = new Reply();
reply.setId("c42");
return new ReplyEvent(repository, pullRequest, reply, reply, null, HandlerEventType.MODIFY);
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class EventListenerTest method createPullRequestMergedEvent.
private PullRequestMergedEvent createPullRequestMergedEvent() {
Repository repository = RepositoryTestData.createHeartOfGold();
PullRequest pullRequest = TestData.createPullRequest();
mockChannel(repository, pullRequest);
return new PullRequestMergedEvent(repository, pullRequest);
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class EventListenerTest method createPullRequestUpdatedEvent.
private PullRequestUpdatedEvent createPullRequestUpdatedEvent() {
Repository repository = RepositoryTestData.createHeartOfGold();
PullRequest pullRequest = TestData.createPullRequest();
mockChannel(repository, pullRequest);
return new PullRequestUpdatedEvent(repository, pullRequest);
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class BranchRevisionResolverTest method shouldGetRevisionsForPullRequest.
@Test
void shouldGetRevisionsForPullRequest() throws IOException {
when(repositoryServiceFactory.create(NAMESPACE_AND_NAME)).thenReturn(repositoryService);
PullRequest pullRequest = TestData.createPullRequest();
setUpBranches(pullRequest);
mockSingleChangeset(pullRequest.getSource());
mockSingleChangeset(pullRequest.getTarget());
BranchRevisionResolver.RevisionResult revisions = branchRevisionResolver.getRevisions(NAMESPACE_AND_NAME, pullRequest);
Assertions.assertThat(revisions.getSourceRevision()).isEqualTo(pullRequest.getSource() + "Id");
Assertions.assertThat(revisions.getTargetRevision()).isEqualTo(pullRequest.getTarget() + "Id");
}
Aggregations