Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
6a0d9bb8
Commit
6a0d9bb8
authored
Feb 17, 2018
by
Greg Messner
Browse files
Added tests for merge request notes (#140).
parent
54e58dc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestNotesApi.java
View file @
6a0d9bb8
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
org.gitlab4j.api.Constants.SortOrder
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.Issue
;
import
org.gitlab4j.api.models.Issue
;
import
org.gitlab4j.api.models.MergeRequest
;
import
org.gitlab4j.api.models.Note
;
import
org.gitlab4j.api.models.Note
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
import
org.junit.Before
;
import
org.junit.Before
;
...
@@ -79,7 +81,7 @@ public class TestNotesApi {
...
@@ -79,7 +81,7 @@ public class TestNotesApi {
}
}
@Test
@Test
public
void
testNotes
()
throws
GitLabApiException
{
public
void
test
Issue
Notes
()
throws
GitLabApiException
{
Project
project
=
gitLabApi
.
getProjectApi
().
getProject
(
TEST_NAMESPACE
,
TEST_PROJECT_NAME
);
Project
project
=
gitLabApi
.
getProjectApi
().
getProject
(
TEST_NAMESPACE
,
TEST_PROJECT_NAME
);
assertNotNull
(
project
);
assertNotNull
(
project
);
...
@@ -87,8 +89,42 @@ public class TestNotesApi {
...
@@ -87,8 +89,42 @@ public class TestNotesApi {
for
(
Issue
issue
:
gitLabApi
.
getIssuesApi
().
getIssues
(
project
.
getId
()))
{
for
(
Issue
issue
:
gitLabApi
.
getIssuesApi
().
getIssues
(
project
.
getId
()))
{
List
<
Note
>
notes
=
gitLabApi
.
getNotesApi
().
getIssueNotes
(
project
.
getId
(),
issue
.
getIid
());
List
<
Note
>
notes
=
gitLabApi
.
getNotesApi
().
getIssueNotes
(
project
.
getId
(),
issue
.
getIid
());
assertNotNull
(
notes
);
assertNotNull
(
notes
);
// This requires some issues in the project
}
// assertTrue(0 < notes.size());
}
@Test
public
void
testIssueNotesPager
()
throws
GitLabApiException
{
Project
project
=
gitLabApi
.
getProjectApi
().
getProject
(
TEST_NAMESPACE
,
TEST_PROJECT_NAME
);
assertNotNull
(
project
);
for
(
Issue
issue
:
gitLabApi
.
getIssuesApi
().
getIssues
(
project
.
getId
()))
{
Pager
<
Note
>
pager
=
gitLabApi
.
getNotesApi
().
getIssueNotes
(
project
.
getId
(),
issue
.
getIid
(),
10
);
assertNotNull
(
pager
);
}
}
@Test
public
void
testMergeRequestNotes
()
throws
GitLabApiException
{
Project
project
=
gitLabApi
.
getProjectApi
().
getProject
(
TEST_NAMESPACE
,
TEST_PROJECT_NAME
);
assertNotNull
(
project
);
for
(
MergeRequest
mr
:
gitLabApi
.
getMergeRequestApi
().
getMergeRequests
(
project
.
getId
()))
{
List
<
Note
>
notes
=
gitLabApi
.
getNotesApi
().
getMergeRequestNotes
(
project
.
getId
(),
mr
.
getIid
());
assertNotNull
(
notes
);
}
}
@Test
public
void
testMergeRequestNotesPager
()
throws
GitLabApiException
{
Project
project
=
gitLabApi
.
getProjectApi
().
getProject
(
TEST_NAMESPACE
,
TEST_PROJECT_NAME
);
assertNotNull
(
project
);
for
(
MergeRequest
mr
:
gitLabApi
.
getMergeRequestApi
().
getMergeRequests
(
project
.
getId
()))
{
Pager
<
Note
>
pager
=
gitLabApi
.
getNotesApi
().
getMergeRequestNotes
(
project
.
getId
(),
mr
.
getIid
(),
SortOrder
.
DESC
,
Note
.
OrderBy
.
CREATED_AT
,
10
);
assertNotNull
(
pager
);
}
}
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment