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
9f480b3c
Commit
9f480b3c
authored
Aug 26, 2017
by
Greg Messner
Browse files
Added tests for getComments() and addComment() (#67).
parent
fb692b80
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestCommitsApi.java
View file @
9f480b3c
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
import
static
org
.
junit
.
Assume
.
assumeTrue
;
...
@@ -8,6 +9,7 @@ import java.util.Date;
...
@@ -8,6 +9,7 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.GitLabApi.ApiVersion
;
import
org.gitlab4j.api.models.Comment
;
import
org.gitlab4j.api.models.Commit
;
import
org.gitlab4j.api.models.Commit
;
import
org.gitlab4j.api.models.Diff
;
import
org.gitlab4j.api.models.Diff
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.models.Project
;
...
@@ -99,6 +101,26 @@ public class TestCommitsApi {
...
@@ -99,6 +101,26 @@ public class TestCommitsApi {
assertTrue
(
diffs
.
size
()
>
0
);
assertTrue
(
diffs
.
size
()
>
0
);
}
}
@Test
public
void
testComments
()
throws
GitLabApiException
{
Project
project
=
gitLabApi
.
getProjectApi
().
getProject
(
TEST_NAMESPACE
,
TEST_PROJECT_NAME
);
assertNotNull
(
project
);
List
<
Commit
>
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
project
.
getId
(),
null
,
new
Date
(
0
),
new
Date
());
assertNotNull
(
commits
);
assertTrue
(
commits
.
size
()
>
0
);
String
note
=
"This is a note."
;
Comment
addedComment
=
gitLabApi
.
getCommitsApi
().
addComment
(
project
.
getId
(),
commits
.
get
(
0
).
getId
(),
note
);
assertNotNull
(
addedComment
);
assertEquals
(
note
,
addedComment
.
getNote
());
List
<
Comment
>
comments
=
gitLabApi
.
getCommitsApi
().
getComments
(
project
.
getId
(),
commits
.
get
(
0
).
getId
());
assertNotNull
(
comments
);
assertTrue
(
comments
.
size
()
>
0
);
}
@Test
@Test
public
void
testCommitsSince
()
throws
GitLabApiException
{
public
void
testCommitsSince
()
throws
GitLabApiException
{
...
...
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