|
1 | 1 | package org.gitlab4j.api; |
2 | 2 |
|
| 3 | +import static org.junit.Assert.assertEquals; |
3 | 4 | import static org.junit.Assert.assertNotNull; |
4 | 5 | import static org.junit.Assert.assertTrue; |
5 | 6 | import static org.junit.Assume.assumeTrue; |
|
8 | 9 | import java.util.List; |
9 | 10 |
|
10 | 11 | import org.gitlab4j.api.GitLabApi.ApiVersion; |
| 12 | +import org.gitlab4j.api.models.Comment; |
11 | 13 | import org.gitlab4j.api.models.Commit; |
12 | 14 | import org.gitlab4j.api.models.Diff; |
13 | 15 | import org.gitlab4j.api.models.Project; |
@@ -99,6 +101,26 @@ public void testDiff() throws GitLabApiException { |
99 | 101 | assertTrue(diffs.size() > 0); |
100 | 102 | } |
101 | 103 |
|
| 104 | + @Test |
| 105 | + public void testComments() throws GitLabApiException { |
| 106 | + |
| 107 | + Project project = gitLabApi.getProjectApi().getProject(TEST_NAMESPACE, TEST_PROJECT_NAME); |
| 108 | + assertNotNull(project); |
| 109 | + |
| 110 | + List<Commit> commits = gitLabApi.getCommitsApi().getCommits(project.getId(), null, new Date(0), new Date()); |
| 111 | + assertNotNull(commits); |
| 112 | + assertTrue(commits.size() > 0); |
| 113 | + |
| 114 | + String note = "This is a note."; |
| 115 | + Comment addedComment = gitLabApi.getCommitsApi().addComment(project.getId(), commits.get(0).getId(), note); |
| 116 | + assertNotNull(addedComment); |
| 117 | + assertEquals(note, addedComment.getNote()); |
| 118 | + |
| 119 | + List<Comment> comments = gitLabApi.getCommitsApi().getComments(project.getId(), commits.get(0).getId()); |
| 120 | + assertNotNull(comments); |
| 121 | + assertTrue(comments.size() > 0); |
| 122 | + } |
| 123 | + |
102 | 124 | @Test |
103 | 125 | public void testCommitsSince() throws GitLabApiException { |
104 | 126 |
|
|
0 commit comments