use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class CommentCollectorTest method shouldCollectNonOutdatedComments.
@Test
void shouldCollectNonOutdatedComments() {
Repository repository = RepositoryTestData.createHeartOfGold();
PullRequest pullRequest = TestData.createPullRequest();
Comment one = Comment.createSystemComment("hello");
Comment two = Comment.createSystemComment("hello");
two.setOutdated(true);
List<Comment> prcs = ImmutableList.of(one, two);
when(commentService.getAll(repository.getNamespace(), repository.getName(), pullRequest.getId())).thenReturn(prcs);
Stream<Comment> comments = collector.collectNonOutdated(repository, pullRequest);
assertThat(comments).containsOnly(one);
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class StatusCheckHookTest method mockOpenPullRequest.
private PullRequest mockOpenPullRequest() {
PullRequest pullRequest = new PullRequest();
pullRequest.setStatus(PullRequestStatus.OPEN);
pullRequest.setSource("source");
pullRequest.setTarget("target");
when(pullRequestService.getAll(NAMESPACE, NAME)).thenReturn(singletonList(pullRequest));
return pullRequest;
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class CommentIndexerTest method shouldDeleteCommentFromIndex.
@Test
void shouldDeleteCommentFromIndex() {
PullRequest pr = createPullRequest();
Comment comment = Comment.createComment("1", "first one", "trillian", new Location());
indexer.handleEvent(new CommentEvent(repository, pr, null, comment, HandlerEventType.DELETE));
verify(forType).update(any(SerializableIndexTask.class));
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class CommentIndexerTest method shouldIndexCommentForCommentEvent.
@Test
void shouldIndexCommentForCommentEvent() {
PullRequest pr = createPullRequest();
Comment comment = Comment.createComment("1", "first one", "trillian", new Location());
indexer.handleEvent(new CommentEvent(repository, pr, comment, comment, HandlerEventType.CREATE));
verify(forType).update(any(SerializableIndexTask.class));
}
use of com.cloudogu.scm.review.pullrequest.service.PullRequest in project scm-review-plugin by scm-manager.
the class CommentIndexerTest method shouldDeleteReplyFromIndexForReplyEvent.
@Test
void shouldDeleteReplyFromIndexForReplyEvent() {
PullRequest pr = createPullRequest();
Comment comment = Comment.createComment("1", "first one", "trillian", new Location());
Reply reply = Reply.createReply("1", "first one", "trillian");
indexer.handleEvent(new ReplyEvent(repository, pr, null, reply, comment, HandlerEventType.DELETE));
verify(forType).update(any(SerializableIndexTask.class));
}
Aggregations