Search in sources :

Example 1 with PullRequestEmergencyMergedEvent

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

the class CommentServiceTest method shouldAddCommentOnEmergencyMergeEvent.

@Test
public void shouldAddCommentOnEmergencyMergeEvent() {
    String overrideMessage = "really urgent";
    PullRequest pullRequest = mockPullRequest();
    when(store.add(eq(PULL_REQUEST_ID), rootCommentCaptor.capture())).thenReturn("newId");
    when(pullRequest.getOverrideMessage()).thenReturn(overrideMessage);
    commentService.addCommentOnEmergencyMerge(new PullRequestEmergencyMergedEvent(REPOSITORY, pullRequest));
    assertThat(rootCommentCaptor.getAllValues()).hasSize(1);
    Comment storedComment = rootCommentCaptor.getValue();
    assertThat(storedComment.getComment()).isEqualTo(overrideMessage);
    assertThat(storedComment.isEmergencyMerged()).isTrue();
    assertThat(storedComment.getAuthor()).isEqualTo("author");
}
Also used : Comment.createComment(com.cloudogu.scm.review.comment.service.Comment.createComment) PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) PullRequestEmergencyMergedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestEmergencyMergedEvent) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Aggregations

Comment.createComment (com.cloudogu.scm.review.comment.service.Comment.createComment)1 PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)1 PullRequestEmergencyMergedEvent (com.cloudogu.scm.review.pullrequest.service.PullRequestEmergencyMergedEvent)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1