use of com.cloudogu.scm.review.comment.service.ReplyEvent in project scm-review-plugin by scm-manager.
the class RemoveReviewMarksOnChangedCommentsHookTest method shouldRemoveMarksOnNewReplyOnCommentWithSameLocation.
@Test
void shouldRemoveMarksOnNewReplyOnCommentWithSameLocation() {
Reply reply = Reply.createReply("321", "reply", "trillian");
comment.setLocation(new Location("some/file"));
comment.setReplies(singletonList(reply));
pullRequest.setReviewMarks(of(new ReviewMark("some/file", "dent")));
when(commentService.getAll(repository.getNamespace(), repository.getName(), pullRequest.getId())).thenReturn(singletonList(comment));
ReplyEvent event = new ReplyEvent(repository, pullRequest, reply, null, comment, HandlerEventType.CREATE);
hook.handleReplyEvents(event);
verify(pullRequestService).removeReviewMarks(repository, pullRequest.getId(), singletonList(new ReviewMark("some/file", "dent")));
}
use of com.cloudogu.scm.review.comment.service.ReplyEvent in project scm-review-plugin by scm-manager.
the class RemoveReviewMarksOnChangedCommentsHookTest method shouldIgnoreReplyOnCommentWithoutLocation.
@Test
void shouldIgnoreReplyOnCommentWithoutLocation() {
Reply reply = Reply.createReply("321", "reply", "trillian");
comment.setReplies(singletonList(reply));
pullRequest.setReviewMarks(of(new ReviewMark("some/file", "dent")));
when(commentService.getAll(repository.getNamespace(), repository.getName(), pullRequest.getId())).thenReturn(singletonList(comment));
ReplyEvent event = new ReplyEvent(repository, pullRequest, reply, null, comment, HandlerEventType.CREATE);
hook.handleReplyEvents(event);
verify(pullRequestService, never()).removeReviewMarks(any(), any(), any());
}
use of com.cloudogu.scm.review.comment.service.ReplyEvent in project scm-review-plugin by scm-manager.
the class RemoveReviewMarksOnChangedCommentsHookTest method shouldIgnoreDeletedReply.
@Test
void shouldIgnoreDeletedReply() {
Reply reply = Reply.createReply("321", "reply", "trillian");
ReplyEvent event = new ReplyEvent(repository, pullRequest, null, reply, comment, HandlerEventType.DELETE);
hook.handleReplyEvents(event);
verify(pullRequestService, never()).removeReviewMarks(any(), any(), any());
}
use of com.cloudogu.scm.review.comment.service.ReplyEvent in project scm-review-plugin by scm-manager.
the class EventListenerTest method createReplyEvent.
private ReplyEvent createReplyEvent() {
Repository repository = RepositoryTestData.createHeartOfGold();
PullRequest pullRequest = TestData.createPullRequest();
mockChannel(repository, pullRequest);
Reply reply = new Reply();
reply.setId("c42");
return new ReplyEvent(repository, pullRequest, reply, reply, null, HandlerEventType.MODIFY);
}
use of com.cloudogu.scm.review.comment.service.ReplyEvent in project scm-review-plugin by scm-manager.
the class EventListenerTest method shouldBroadcastMessageForReplyEvent.
@Test
void shouldBroadcastMessageForReplyEvent() {
SessionId sessionId = bindSessionId("4-2");
ReplyEvent event = createReplyEvent();
listener.handle(event);
verify(channel).broadcast(captor.capture());
assertMessageHasCorrectTypeAndName(ReplyEvent.class);
}
Aggregations