Search in sources :

Example 1 with PullRequestEvent

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

the class EventListenerTest method shouldBroadcastMessageForPullRequestEvent.

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

Example 2 with PullRequestEvent

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

Example 3 with PullRequestEvent

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

the class MailTextResolverTest method shouldNotRenderReviewerEmailOnCreatedPullRequest.

@Test
void shouldNotRenderReviewerEmailOnCreatedPullRequest() {
    PullRequestEvent event = new PullRequestEvent(repository, pullRequest, oldPullRequest, HandlerEventType.CREATE);
    PullRequestEventMailTextResolver renderer = new PullRequestEventMailTextResolver(event, false);
    assertEmail(renderer, "created").doesNotContain("You are chosen as reviewer for this pull request.");
}
Also used : PullRequestEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestEvent) Test(org.junit.jupiter.api.Test)

Example 4 with PullRequestEvent

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

the class MailTextResolverTest method shouldRenderEmailOnModifiedPullRequest.

@Test
void shouldRenderEmailOnModifiedPullRequest() {
    PullRequestEvent event = new PullRequestEvent(repository, pullRequest, oldPullRequest, HandlerEventType.MODIFY);
    PullRequestEventMailTextResolver renderer = new PullRequestEventMailTextResolver(event, false);
    assertEmail(renderer, "changed");
}
Also used : PullRequestEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestEvent) Test(org.junit.jupiter.api.Test)

Example 5 with PullRequestEvent

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

the class EventListenerTest method shouldSendSessionIdWithMessage.

@Test
void shouldSendSessionIdWithMessage() {
    SessionId sessionId = bindSessionId("1-2-3");
    PullRequestEvent event = createPullRequestEvent();
    listener.handle(event);
    verify(channel).broadcast(captor.capture());
    assertMessageHasCorrectTypeAndName(PullRequestEvent.class);
    assertThat(captor.getValue().getSender()).contains(sessionId);
}
Also used : BasicPullRequestEvent(com.cloudogu.scm.review.pullrequest.service.BasicPullRequestEvent) PullRequestEvent(com.cloudogu.scm.review.pullrequest.service.PullRequestEvent) SessionId(sonia.scm.security.SessionId) Test(org.junit.jupiter.api.Test)

Aggregations

PullRequestEvent (com.cloudogu.scm.review.pullrequest.service.PullRequestEvent)6 Test (org.junit.jupiter.api.Test)5 BasicPullRequestEvent (com.cloudogu.scm.review.pullrequest.service.BasicPullRequestEvent)3 PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)1 Repository (sonia.scm.repository.Repository)1 SessionId (sonia.scm.security.SessionId)1