use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class CommentServiceTest method mockPullRequest.
private PullRequest mockPullRequest() {
PullRequest mock = mock(PullRequest.class);
when(mock.getId()).thenReturn(PULL_REQUEST_ID);
return mock;
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest 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");
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest 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.PullRequest in project scm-review-plugin by scm-manager.
the class EventListenerTest method createPullRequestEvent.
private PullRequestEvent createPullRequestEvent() {
Repository repository = RepositoryTestData.createHeartOfGold();
PullRequest pullRequest = TestData.createPullRequest();
mockChannel(repository, pullRequest);
return new PullRequestEvent(repository, pullRequest, null, HandlerEventType.CREATE);
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class EventListenerTest method createCommentEvent.
private CommentEvent createCommentEvent() {
Repository repository = RepositoryTestData.createHeartOfGold();
PullRequest pullRequest = TestData.createPullRequest();
mockChannel(repository, pullRequest);
Comment comment = new Comment();
comment.setId("c42");
return new CommentEvent(repository, pullRequest, null, comment, HandlerEventType.DELETE);
}
Aggregations