use of com.cloudogu.scm.review.pullrequest.service.PullRequestRejectedEvent in project scm-review-plugin by scm-manager.
the class CommentServiceTest method shouldAddCommentOnRejectEventByUser.
@Test
@SubjectAware(username = "dent")
public void shouldAddCommentOnRejectEventByUser() {
when(store.add(eq(PULL_REQUEST_ID), rootCommentCaptor.capture())).thenReturn("newId");
commentService.addCommentOnReject(new PullRequestRejectedEvent(REPOSITORY, mockPullRequest(), PullRequestRejectedEvent.RejectionCause.REJECTED_BY_USER));
assertThat(rootCommentCaptor.getAllValues()).hasSize(1);
Comment storedComment = rootCommentCaptor.getValue();
assertThat(storedComment.getComment()).isEqualTo("rejected");
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequestRejectedEvent in project scm-review-plugin by scm-manager.
the class EventListenerTest method createPullRequestRejectedEvent.
private PullRequestRejectedEvent createPullRequestRejectedEvent() {
Repository repository = RepositoryTestData.createHeartOfGold();
PullRequest pullRequest = TestData.createPullRequest();
mockChannel(repository, pullRequest);
return new PullRequestRejectedEvent(repository, pullRequest, PullRequestRejectedEvent.RejectionCause.BRANCH_DELETED);
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequestRejectedEvent in project scm-review-plugin by scm-manager.
the class EventListenerTest method shouldBroadcastPullRequestRejectedEvent.
@Test
void shouldBroadcastPullRequestRejectedEvent() {
bindSessionId("1-2-3");
PullRequestRejectedEvent event = createPullRequestRejectedEvent();
listener.handle(event);
verify(channel).broadcast(captor.capture());
assertMessageHasCorrectTypeAndName(PullRequestRejectedEvent.class);
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequestRejectedEvent in project scm-review-plugin by scm-manager.
the class EmailNotificationHookTest method shouldSendEmailsAfterRejectingPullRequest.
@Test
void shouldSendEmailsAfterRejectingPullRequest() throws Exception {
PullRequestRejectedEvent event = new PullRequestRejectedEvent(repository, pullRequest, PullRequestRejectedEvent.RejectionCause.REJECTED_BY_USER);
emailNotificationHook.handleRejectedPullRequest(event);
verify(service).sendEmail(eq(of(subscribedButNotReviewer, subscribedAndReviewer)), isA(PullRequestRejectedMailTextResolver.class));
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequestRejectedEvent 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");
}
Aggregations