Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public URL getHtmlUrl() {
}

protected String getApiRoute() {
return "/repos/"+owner.getRepository().getFullName()+"/comments/"+id;
return "/repos/"+owner.getRepository().getFullName()+"/pulls/comments/"+id;
}

/**
Expand Down
37 changes: 35 additions & 2 deletions src/test/java/org/kohsuke/github/PullRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.io.IOException;
import java.util.Collection;
import java.util.List;

/**
* @author Kohsuke Kawaguchi
Expand All @@ -18,7 +19,38 @@ public void createPullRequest() throws Exception {
assertEquals(name, p.getTitle());
}

@Test // Requires push access to the test repo to pass
@Test
public void createPullRequestComment() throws Exception {
String name = rnd.next();
GHPullRequest p = getRepository().createPullRequest(name, "stable", "master", "## test");
p.comment("Some comment");
}

@Test
public void testPullRequestReviewComments() throws Exception {
String name = rnd.next();
GHPullRequest p = getRepository().createPullRequest(name, "stable", "master", "## test");
System.out.println(p.getUrl());
assertTrue(p.listReviewComments().asList().isEmpty());
p.createReviewComment("Sample review comment", p.getHead().getSha(), "cli/pom.xml", 5);
List<GHPullRequestReviewComment> comments = p.listReviewComments().asList();
assertEquals(1, comments.size());
GHPullRequestReviewComment comment = comments.get(0);
assertEquals("Sample review comment", comment.getBody());

comment.update("Updated review comment");
comments = p.listReviewComments().asList();
assertEquals(1, comments.size());
comment = comments.get(0);
assertEquals("Updated review comment", comment.getBody());

comment.delete();
comments = p.listReviewComments().asList();
assertTrue(comments.isEmpty());
}

@Test
// Requires push access to the test repo to pass
public void setLabels() throws Exception {
GHPullRequest p = getRepository().createPullRequest(rnd.next(), "stable", "master", "## test");
String label = rnd.next();
Expand All @@ -29,7 +61,8 @@ public void setLabels() throws Exception {
assertEquals(label, labels.iterator().next().getName());
}

@Test // Requires push access to the test repo to pass
@Test
// Requires push access to the test repo to pass
public void setAssignee() throws Exception {
GHPullRequest p = getRepository().createPullRequest(rnd.next(), "stable", "master", "## test");
GHMyself user = gitHub.getMyself();
Expand Down