mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
Massaged the changes
- Restored binary compatibility. The draft API has changed in some significant way when it became public, and the PR took the liberty to delete removed constants and method signatures. I brought them back so that older clients can keep functioning. - Introduced a builder pattern to create PR review - replying to a review comment should be an instance method, not a static method. - GHPullRequestReview and GHPullRequestReviewDraft was not making sense to me, since GitHub API doesn't differentiate them. It creates a practical problem of not being able to submit a review comment unless you created the review comment in the same JVM session. That said, I don't understand the point of this two phase approach in the GitHub API to begin with!
This commit is contained in:
@@ -7,8 +7,7 @@ import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.notNullValue;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
@@ -33,9 +32,10 @@ public class PullRequestTest extends AbstractGitHubApiTestBase {
|
||||
public void testPullRequestReviews() throws Exception {
|
||||
String name = rnd.next();
|
||||
GHPullRequest p = getRepository().createPullRequest(name, "stable", "master", "## test");
|
||||
GHPullRequestReviewDraft draftReview = p.newDraftReview(null, "Some draft review",
|
||||
GHPullRequestReviewComment.draft("Some niggle", "changelog.html", 1)
|
||||
);
|
||||
GHPullRequestReview draftReview = p.createReview()
|
||||
.body("Some draft review")
|
||||
.comment("Some niggle", "changelog.html", 1)
|
||||
.create();
|
||||
assertThat(draftReview.getState(), is(GHPullRequestReviewState.PENDING));
|
||||
assertThat(draftReview.getBody(), is("Some draft review"));
|
||||
assertThat(draftReview.getCommitId(), notNullValue());
|
||||
@@ -50,9 +50,10 @@ public class PullRequestTest extends AbstractGitHubApiTestBase {
|
||||
assertEquals(1, comments.size());
|
||||
GHPullRequestReviewComment comment = comments.get(0);
|
||||
assertEquals("Some niggle", comment.getBody());
|
||||
draftReview = p.newDraftReview(null, "Some new review",
|
||||
GHPullRequestReviewComment.draft("Some niggle", "changelog.html", 1)
|
||||
);
|
||||
draftReview = p.createReview()
|
||||
.body("Some new review")
|
||||
.comment("Some niggle", "changelog.html", 1)
|
||||
.create();
|
||||
draftReview.delete();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user