Search in sources :

Example 6 with CommentEvent

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

the class MailTextResolverTest method shouldRenderEmailOnModifiedComment.

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

Example 7 with CommentEvent

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

the class MailTextResolverTest method shouldRenderEmailOnCommentTransition.

@Test
void shouldRenderEmailOnCommentTransition() {
    Comment taskComment = oldComment.clone();
    taskComment.addCommentTransition(new ExecutedTransition<>("new", CommentTransition.MAKE_TASK, System.currentTimeMillis(), "dent"));
    CommentEvent event = new CommentEvent(repository, pullRequest, comment, oldComment, HandlerEventType.MODIFY);
    CommentEventMailTextResolver renderer = new CommentEventMailTextResolver(event);
    assertEmail(renderer, "changed");
}
Also used : Comment(com.cloudogu.scm.review.comment.service.Comment) CommentEvent(com.cloudogu.scm.review.comment.service.CommentEvent) Test(org.junit.jupiter.api.Test)

Example 8 with CommentEvent

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

the class RemoveReviewMarksOnChangedCommentsHookTest method shouldIgnoreCommentDeletion.

@Test
void shouldIgnoreCommentDeletion() {
    CommentEvent event = new CommentEvent(repository, pullRequest, null, comment, HandlerEventType.DELETE);
    hook.handleCommentEvents(event);
    verify(pullRequestService, never()).removeReviewMarks(any(), any(), any());
}
Also used : CommentEvent(com.cloudogu.scm.review.comment.service.CommentEvent) Test(org.junit.jupiter.api.Test)

Example 9 with CommentEvent

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

the class RemoveReviewMarksOnChangedCommentsHookTest method shouldNotRemoveMarksOnNewCommentWithDifferentLocation.

@Test
void shouldNotRemoveMarksOnNewCommentWithDifferentLocation() {
    comment.setLocation(new Location("some/other/file"));
    pullRequest.setReviewMarks(of(new ReviewMark("some/file", "dent")));
    CommentEvent event = new CommentEvent(repository, pullRequest, comment, null, HandlerEventType.CREATE);
    hook.handleCommentEvents(event);
    verify(pullRequestService, atMost(1)).removeReviewMarks(repository, pullRequest.getId(), emptyList());
}
Also used : CommentEvent(com.cloudogu.scm.review.comment.service.CommentEvent) Location(com.cloudogu.scm.review.comment.service.Location) Test(org.junit.jupiter.api.Test)

Example 10 with CommentEvent

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

the class RemoveReviewMarksOnChangedCommentsHookTest method shouldIgnoreCommentsWithoutLocation.

@Test
void shouldIgnoreCommentsWithoutLocation() {
    CommentEvent event = new CommentEvent(repository, pullRequest, comment, null, HandlerEventType.CREATE);
    hook.handleCommentEvents(event);
    verify(pullRequestService, never()).removeReviewMarks(any(), any(), any());
}
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