Search in sources :

Example 1 with CommentEvent

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

Example 2 with CommentEvent

use of com.cloudogu.scm.review.comment.service.CommentEvent in project scm-review-plugin by scm-manager.

the class EmailNotificationHookTest method shouldNotSendSystemEmails.

@Test
void shouldNotSendSystemEmails() throws Exception {
    Comment systemComment = Comment.createSystemComment("1");
    CommentEvent commentEvent = new CommentEvent(repository, pullRequest, systemComment, oldComment, HandlerEventType.CREATE);
    emailNotificationHook.handleCommentEvents(commentEvent);
    verify(service, never()).sendEmail(any(), any());
    verify(service, never()).sendEmail(any(), any());
    reset(service);
}
Also used : Comment(com.cloudogu.scm.review.comment.service.Comment) CommentEvent(com.cloudogu.scm.review.comment.service.CommentEvent) Test(org.junit.jupiter.api.Test) DynamicTest(org.junit.jupiter.api.DynamicTest)

Example 3 with CommentEvent

use of com.cloudogu.scm.review.comment.service.CommentEvent in project scm-review-plugin by scm-manager.

the class MailTextResolverTest method shouldRenderEmailOnDeletedComment.

@Test
void shouldRenderEmailOnDeletedComment() {
    CommentEvent event = new CommentEvent(repository, pullRequest, comment, oldComment, HandlerEventType.DELETE);
    CommentEventMailTextResolver renderer = new CommentEventMailTextResolver(event);
    assertEmail(renderer, "deleted");
}
Also used : CommentEvent(com.cloudogu.scm.review.comment.service.CommentEvent) Test(org.junit.jupiter.api.Test)

Example 4 with CommentEvent

use of com.cloudogu.scm.review.comment.service.CommentEvent in project scm-review-plugin by scm-manager.

the class MailTextResolverTest method shouldRenderEmailOnCreatedComment.

@Test
void shouldRenderEmailOnCreatedComment() {
    CommentEvent event = new CommentEvent(repository, pullRequest, comment, oldComment, HandlerEventType.CREATE);
    CommentEventMailTextResolver renderer = new CommentEventMailTextResolver(event);
    assertEmail(renderer, "added");
}
Also used : CommentEvent(com.cloudogu.scm.review.comment.service.CommentEvent) Test(org.junit.jupiter.api.Test)

Example 5 with CommentEvent

use of com.cloudogu.scm.review.comment.service.CommentEvent in project scm-review-plugin by scm-manager.

the class EventListenerTest method shouldBroadcastMessageForCommentEvent.

@Test
void shouldBroadcastMessageForCommentEvent() {
    bindSessionId("4-2");
    CommentEvent event = createCommentEvent();
    listener.handle(event);
    verify(channel).broadcast(captor.capture());
    assertMessageHasCorrectTypeAndName(CommentEvent.class);
}
Also used : CommentEvent(com.cloudogu.scm.review.comment.service.CommentEvent) Test(org.junit.jupiter.api.Test)

Aggregations

CommentEvent (com.cloudogu.scm.review.comment.service.CommentEvent)11 Test (org.junit.jupiter.api.Test)10 Comment (com.cloudogu.scm.review.comment.service.Comment)3 Location (com.cloudogu.scm.review.comment.service.Location)2 PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)1 DynamicTest (org.junit.jupiter.api.DynamicTest)1 Repository (sonia.scm.repository.Repository)1