55
66import java .io .IOException ;
77import java .util .Collection ;
8+ import java .util .List ;
89
910/**
1011 * @author Kohsuke Kawaguchi
@@ -18,7 +19,38 @@ public void createPullRequest() throws Exception {
1819 assertEquals (name , p .getTitle ());
1920 }
2021
21- @ Test // Requires push access to the test repo to pass
22+ @ Test
23+ public void createPullRequestComment () throws Exception {
24+ String name = rnd .next ();
25+ GHPullRequest p = getRepository ().createPullRequest (name , "stable" , "master" , "## test" );
26+ p .comment ("Some comment" );
27+ }
28+
29+ @ Test
30+ public void testPullRequestReviewComments () throws Exception {
31+ String name = rnd .next ();
32+ GHPullRequest p = getRepository ().createPullRequest (name , "stable" , "master" , "## test" );
33+ System .out .println (p .getUrl ());
34+ assertTrue (p .listReviewComments ().asList ().isEmpty ());
35+ p .createReviewComment ("Sample review comment" , p .getHead ().getSha (), "cli/pom.xml" , 5 );
36+ List <GHPullRequestReviewComment > comments = p .listReviewComments ().asList ();
37+ assertEquals (1 , comments .size ());
38+ GHPullRequestReviewComment comment = comments .get (0 );
39+ assertEquals ("Sample review comment" , comment .getBody ());
40+
41+ comment .update ("Updated review comment" );
42+ comments = p .listReviewComments ().asList ();
43+ assertEquals (1 , comments .size ());
44+ comment = comments .get (0 );
45+ assertEquals ("Updated review comment" , comment .getBody ());
46+
47+ comment .delete ();
48+ comments = p .listReviewComments ().asList ();
49+ assertTrue (comments .isEmpty ());
50+ }
51+
52+ @ Test
53+ // Requires push access to the test repo to pass
2254 public void setLabels () throws Exception {
2355 GHPullRequest p = getRepository ().createPullRequest (rnd .next (), "stable" , "master" , "## test" );
2456 String label = rnd .next ();
@@ -29,7 +61,8 @@ public void setLabels() throws Exception {
2961 assertEquals (label , labels .iterator ().next ().getName ());
3062 }
3163
32- @ Test // Requires push access to the test repo to pass
64+ @ Test
65+ // Requires push access to the test repo to pass
3366 public void setAssignee () throws Exception {
3467 GHPullRequest p = getRepository ().createPullRequest (rnd .next (), "stable" , "master" , "## test" );
3568 GHMyself user = gitHub .getMyself ();
0 commit comments