Search in sources :

Example 1 with PullRequestComment

use of com.google.copybara.git.github.api.PullRequestComment in project copybara by google.

the class AbstractGitHubApiTest method testGetPullRequestComment.

@Test
public void testGetPullRequestComment() throws Exception {
    trainMockGet("/repos/example/project/pulls/comments/12345", getResource("pulls_comment_12345_testdata.json"));
    PullRequestComment pullRequestComment = api.getPullRequestComment("example/project", 12345);
    assertThat(pullRequestComment.getId()).isEqualTo(12345);
    assertThat(pullRequestComment.getPosition()).isEqualTo(13);
    assertThat(pullRequestComment.getOriginalPosition()).isEqualTo(13);
    assertThat(pullRequestComment.getPath()).contains("git/GitEnvironment.java");
    assertThat(pullRequestComment.getUser().getLogin()).isEqualTo("googletestuser");
    assertThat(pullRequestComment.getCommitId()).isEqualTo("228ed14f89c19caed87717a8a53392f58c3a24f9");
    assertThat(pullRequestComment.getOriginalCommitId()).isEqualTo("7a8d55973a82b250e8c206673b2ae1e6bacb97d0");
    assertThat(pullRequestComment.getBody()).isEqualTo("This needs to be fixed.");
    assertThat(pullRequestComment.getDiffHunk()).isEqualTo("@@ -36,11 +35,16 @@ public GitEnvironment(Map<String, String> environment) {\n" + "   }\n" + " \n" + "   public ImmutableMap<String, String> getEnvironment() {\n" + "-    Map<String, String> env = Maps.newHashMap(environment);\n" + "+    ImmutableMap.Builder<String, String> env = ImmutableMap.builder();");
    assertThat(pullRequestComment.getCreatedAt()).isEqualTo(ZonedDateTime.parse("2019-06-21T20:20:20Z"));
    assertThat(pullRequestComment.getUpdatedAt()).isEqualTo(ZonedDateTime.parse("2019-07-18T15:32:41Z"));
}
Also used : PullRequestComment(com.google.copybara.git.github.api.PullRequestComment) Test(org.junit.Test)

Aggregations

PullRequestComment (com.google.copybara.git.github.api.PullRequestComment)1 Test (org.junit.Test)1