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");
}
Aggregations