|
1 | 1 | package org.gitlab4j.api;
|
2 | 2 |
|
| 3 | +import org.gitlab4j.api.Constants.SortOrder; |
3 | 4 | import org.gitlab4j.api.GitLabApi.ApiVersion;
|
4 | 5 | import org.gitlab4j.api.models.Issue;
|
| 6 | +import org.gitlab4j.api.models.MergeRequest; |
5 | 7 | import org.gitlab4j.api.models.Note;
|
6 | 8 | import org.gitlab4j.api.models.Project;
|
7 | 9 | import org.junit.Before;
|
@@ -79,16 +81,50 @@ public void beforeMethod() {
|
79 | 81 | }
|
80 | 82 |
|
81 | 83 | @Test
|
82 |
| - public void testNotes() throws GitLabApiException { |
| 84 | + public void testIssueNotes() throws GitLabApiException { |
83 | 85 |
|
84 | 86 | Project project = gitLabApi.getProjectApi().getProject(TEST_NAMESPACE, TEST_PROJECT_NAME);
|
85 | 87 | assertNotNull(project);
|
86 | 88 |
|
87 | 89 | for (Issue issue : gitLabApi.getIssuesApi().getIssues(project.getId())) {
|
88 | 90 | List<Note> notes = gitLabApi.getNotesApi().getIssueNotes(project.getId(), issue.getIid());
|
89 | 91 | assertNotNull(notes);
|
90 |
| - // This requires some issues in the project |
91 |
| -// assertTrue(0 < notes.size()); |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + @Test |
| 96 | + public void testIssueNotesPager() throws GitLabApiException { |
| 97 | + |
| 98 | + Project project = gitLabApi.getProjectApi().getProject(TEST_NAMESPACE, TEST_PROJECT_NAME); |
| 99 | + assertNotNull(project); |
| 100 | + |
| 101 | + for (Issue issue : gitLabApi.getIssuesApi().getIssues(project.getId())) { |
| 102 | + Pager<Note> pager = gitLabApi.getNotesApi().getIssueNotes(project.getId(), issue.getIid(), 10); |
| 103 | + assertNotNull(pager); |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + @Test |
| 108 | + public void testMergeRequestNotes() throws GitLabApiException { |
| 109 | + |
| 110 | + Project project = gitLabApi.getProjectApi().getProject(TEST_NAMESPACE, TEST_PROJECT_NAME); |
| 111 | + assertNotNull(project); |
| 112 | + |
| 113 | + for (MergeRequest mr : gitLabApi.getMergeRequestApi().getMergeRequests(project.getId())) { |
| 114 | + List<Note> notes = gitLabApi.getNotesApi().getMergeRequestNotes(project.getId(), mr.getIid()); |
| 115 | + assertNotNull(notes); |
| 116 | + } |
| 117 | + } |
| 118 | + |
| 119 | + @Test |
| 120 | + public void testMergeRequestNotesPager() throws GitLabApiException { |
| 121 | + |
| 122 | + Project project = gitLabApi.getProjectApi().getProject(TEST_NAMESPACE, TEST_PROJECT_NAME); |
| 123 | + assertNotNull(project); |
| 124 | + |
| 125 | + for (MergeRequest mr : gitLabApi.getMergeRequestApi().getMergeRequests(project.getId())) { |
| 126 | + Pager<Note> pager = gitLabApi.getNotesApi().getMergeRequestNotes(project.getId(), mr.getIid(), SortOrder.DESC, Note.OrderBy.CREATED_AT, 10); |
| 127 | + assertNotNull(pager); |
92 | 128 | }
|
93 | 129 | }
|
94 | 130 | }
|
0 commit comments