Search in sources :

Example 1 with PullRequestMergedEvent

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

the class CommentServiceTest method shouldAddCommentOnMergeEvent.

@Test
@SubjectAware(username = "dent")
public void shouldAddCommentOnMergeEvent() {
    when(store.add(eq(PULL_REQUEST_ID), rootCommentCaptor.capture())).thenReturn("newId");
    commentService.addCommentOnMerge(new PullRequestMergedEvent(REPOSITORY, mockPullRequest()));
    assertThat(rootCommentCaptor.getAllValues()).hasSize(1);
    Comment storedComment = rootCommentCaptor.getValue();
    assertThat(storedComment.getComment()).isEqualTo("merged");
}
Also used : Comment.createComment(com.cloudogu.scm.review.comment.service.Comment.createComment) PullRequestMergedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestMergedEvent) Test(org.junit.Test) SubjectAware(com.github.sdorra.shiro.SubjectAware)

Example 2 with PullRequestMergedEvent

use of com.cloudogu.scm.review.pullrequest.service.PullRequestMergedEvent 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);
}
Also used : Repository(sonia.scm.repository.Repository) PullRequestMergedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestMergedEvent) PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest)

Example 3 with PullRequestMergedEvent

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

the class EventListenerTest method shouldBroadcastPullRequestMergedEvent.

@Test
void shouldBroadcastPullRequestMergedEvent() {
    bindSessionId("1-2-3");
    PullRequestMergedEvent event = createPullRequestMergedEvent();
    listener.handle(event);
    verify(channel).broadcast(captor.capture());
    assertMessageHasCorrectTypeAndName(PullRequestMergedEvent.class);
}
Also used : PullRequestMergedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestMergedEvent) Test(org.junit.jupiter.api.Test)

Example 4 with PullRequestMergedEvent

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

the class EmailNotificationHookTest method shouldSendEmailsAfterMergingPullRequest.

@Test
void shouldSendEmailsAfterMergingPullRequest() throws Exception {
    PullRequestMergedEvent event = new PullRequestMergedEvent(repository, pullRequest);
    emailNotificationHook.handleMergedPullRequest(event);
    verify(service).sendEmail(eq(of(subscribedButNotReviewer, subscribedAndReviewer)), isA(PullRequestMergedMailTextResolver.class));
}
Also used : PullRequestMergedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestMergedEvent) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 5 with PullRequestMergedEvent

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

the class MailTextResolverTest method shouldRenderEmailOnMergedPullRequest.

@Test
void shouldRenderEmailOnMergedPullRequest() {
    PullRequestMergedEvent event = new PullRequestMergedEvent(repository, pullRequest);
    PullRequestMergedMailTextResolver renderer = new PullRequestMergedMailTextResolver(event);
    assertEmail(renderer, "merged");
}
Also used : PullRequestMergedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestMergedEvent) Test(org.junit.jupiter.api.Test)

Aggregations

PullRequestMergedEvent (com.cloudogu.scm.review.pullrequest.service.PullRequestMergedEvent)5 Test (org.junit.jupiter.api.Test)3 Comment.createComment (com.cloudogu.scm.review.comment.service.Comment.createComment)1 PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)1 SubjectAware (com.github.sdorra.shiro.SubjectAware)1 Test (org.junit.Test)1 DynamicTest (org.junit.jupiter.api.DynamicTest)1 Repository (sonia.scm.repository.Repository)1