Search in sources :

Example 6 with ReplyEvent

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

the class EmailNotificationHookTest method sendingReplyEmailTestFactory.

@TestFactory
Stream<DynamicTest> sendingReplyEmailTestFactory() {
    Reply reply = Reply.createReply("1", "42", currentUser);
    Reply oldReply = Reply.createReply("1", "have to think", currentUser);
    comment.setAuthor("first author");
    comment.setReplies(asList(reply, Reply.createReply("0", "dumb question", "former participant")));
    ArrayList<ReplyEvent> events = Lists.newArrayList(new ReplyEvent(repository, pullRequest, reply, null, comment, HandlerEventType.CREATE), new ReplyEvent(repository, pullRequest, reply, oldReply, comment, HandlerEventType.MODIFY), new ReplyEvent(repository, pullRequest, null, oldReply, comment, HandlerEventType.DELETE));
    return events.stream().map(event -> DynamicTest.dynamicTest(event.getEventType().toString(), () -> {
        emailNotificationHook.handleReplyEvents(event);
        verify(service).sendEmail(eq(of(subscribedButNotReviewer, subscribedAndReviewer)), isA(CommentEventMailTextResolver.class));
        verify(service).sendEmail(eq(of("first author", "former participant")), isA(ReplyEventMailTextResolver.class));
        reset(service);
    }));
}
Also used : ReplyEvent(com.cloudogu.scm.review.comment.service.ReplyEvent) Reply(com.cloudogu.scm.review.comment.service.Reply) TestFactory(org.junit.jupiter.api.TestFactory)

Aggregations

ReplyEvent (com.cloudogu.scm.review.comment.service.ReplyEvent)6 Reply (com.cloudogu.scm.review.comment.service.Reply)5 Test (org.junit.jupiter.api.Test)4 Location (com.cloudogu.scm.review.comment.service.Location)1 PullRequest (com.cloudogu.scm.review.pullrequest.service.PullRequest)1 TestFactory (org.junit.jupiter.api.TestFactory)1 Repository (sonia.scm.repository.Repository)1 SessionId (sonia.scm.security.SessionId)1