Search in sources :

Example 1 with PullRequestUpdatedEvent

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

the class EventListenerTest method shouldBroadcastPullRequestUpdatedEvent.

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

Example 2 with PullRequestUpdatedEvent

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

the class EmailNotificationHookTest method shouldSendEmailsAfterUpdatingPullRequest.

@Test
void shouldSendEmailsAfterUpdatingPullRequest() throws Exception {
    PullRequestUpdatedEvent event = new PullRequestUpdatedEvent(repository, pullRequest);
    emailNotificationHook.handleUpdatedPullRequest(event);
    ArgumentCaptor<PullRequestUpdatedMailTextResolver> captor = ArgumentCaptor.forClass(PullRequestUpdatedMailTextResolver.class);
    verify(service).sendEmail(eq(of(subscribedButNotReviewer, subscribedAndReviewer)), captor.capture());
    PullRequestUpdatedMailTextResolver resolver = captor.getValue();
    assertThat(resolver.getMailSubject(Locale.ENGLISH)).contains("PR updated");
    assertThat(resolver.getTopic()).isEqualTo(TOPIC_PR_UPDATED);
    assertThat(resolver.getContentTemplatePath()).contains("updated_pull_request");
}
Also used : PullRequestUpdatedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestUpdatedEvent) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 3 with PullRequestUpdatedEvent

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

the class EventListenerTest method createPullRequestUpdatedEvent.

private PullRequestUpdatedEvent createPullRequestUpdatedEvent() {
    Repository repository = RepositoryTestData.createHeartOfGold();
    PullRequest pullRequest = TestData.createPullRequest();
    mockChannel(repository, pullRequest);
    return new PullRequestUpdatedEvent(repository, pullRequest);
}
Also used : Repository(sonia.scm.repository.Repository) PullRequest(com.cloudogu.scm.review.pullrequest.service.PullRequest) PullRequestUpdatedEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestUpdatedEvent)

Aggregations

PullRequestUpdatedEvent (com.cloudogu.scm.review.pullrequest.service.PullRequestUpdatedEvent)3 Test (org.junit.jupiter.api.Test)2 PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)1 DynamicTest (org.junit.jupiter.api.DynamicTest)1 Repository (sonia.scm.repository.Repository)1