Search in sources :

Example 1 with PullRequestComments

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

the class AddTypeToCommentUpdateStepTest method shouldAddTypeToPullRequestComments.

@Test
void shouldAddTypeToPullRequestComments() throws IOException {
    Path one = copyResource(store, "1");
    updateStep.doUpdate();
    PullRequestComments commentsOfOne = JAXB.unmarshal(one.toFile(), PullRequestComments.class);
    assertThat(commentsOfOne.getComments()).hasSize(4).extracting(Comment::getType).containsExactly(CommentType.COMMENT, CommentType.COMMENT, CommentType.COMMENT, CommentType.COMMENT);
}
Also used : Path(java.nio.file.Path) PullRequestComments(com.cloudogu.scm.review.comment.service.PullRequestComments) Test(org.junit.jupiter.api.Test)

Example 2 with PullRequestComments

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

the class AddTypeToCommentUpdateStepTest method shouldNotAddTypeToCommentTextContentNode.

@Test
void shouldNotAddTypeToCommentTextContentNode() throws IOException {
    Path one = copyResource(store, "1");
    updateStep.doUpdate();
    PullRequestComments commentsOfOne = JAXB.unmarshal(one.toFile(), PullRequestComments.class);
    assertThat(commentsOfOne.getComments().get(0).getComment()).isEqualTo("Don't panic!");
}
Also used : Path(java.nio.file.Path) PullRequestComments(com.cloudogu.scm.review.comment.service.PullRequestComments) Test(org.junit.jupiter.api.Test)

Example 3 with PullRequestComments

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

the class CommentLocationUpdateStepTest method shouldUpdateLocation.

@Test
void shouldUpdateLocation(@TempDir Path temp) throws Exception {
    Path store = createStore(temp);
    doAnswer(ic -> {
        BiConsumer<String, Path> consumer = ic.getArgument(0);
        consumer.accept("repo", temp);
        return null;
    }).when(resolverInstance).forAllLocations(any());
    Path one = copyResource(store, "1");
    Path two = copyResource(store, "2");
    updateStep.doUpdate();
    PullRequestComments commentsOfOne = JAXB.unmarshal(one.toFile(), PullRequestComments.class);
    assertThat(commentsOfOne.getComments()).hasSize(4).extracting(Comment::getLocation).containsOnly(null, null, new Location("README.md", "@@ -1,3 +1,41 @@", null, 25), new Location("README.md", "@@ -1,3 +1,41 @@", null, 39));
    PullRequestComments commentsOfTwo = JAXB.unmarshal(two.toFile(), PullRequestComments.class);
    assertThat(commentsOfTwo.getComments()).hasSize(3).extracting(Comment::getLocation).containsOnly(new Location("README.md", "@@ -1,3 +1,41 @@", null, 39), new Location("README.md", "@@ -1,3 +1,41 @@", 39, null), new Location("README.md", "@@ -1,3 +1,41 @@", 39, 39));
}
Also used : Path(java.nio.file.Path) PullRequestComments(com.cloudogu.scm.review.comment.service.PullRequestComments) Location(com.cloudogu.scm.review.comment.service.Location) Test(org.junit.jupiter.api.Test)

Example 4 with PullRequestComments

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

the class AddTypeToCommentUpdateStepTest method shouldNotOverwriteExistingTypeInPullRequestComments.

@Test
void shouldNotOverwriteExistingTypeInPullRequestComments() throws IOException {
    Path two = copyResource(store, "2");
    updateStep.doUpdate();
    PullRequestComments commentsOfTwo = JAXB.unmarshal(two.toFile(), PullRequestComments.class);
    assertThat(commentsOfTwo.getComments()).hasSize(3).extracting(Comment::getType).containsExactly(CommentType.COMMENT, CommentType.TASK_TODO, CommentType.TASK_DONE);
}
Also used : Path(java.nio.file.Path) PullRequestComments(com.cloudogu.scm.review.comment.service.PullRequestComments) Test(org.junit.jupiter.api.Test)

Aggregations

PullRequestComments (com.cloudogu.scm.review.comment.service.PullRequestComments)4 Path (java.nio.file.Path)4 Test (org.junit.jupiter.api.Test)4 Location (com.cloudogu.scm.review.comment.service.Location)1