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
7268fef0
Commit
7268fef0
authored
Apr 22, 2019
by
Greg Messner
Browse files
Fixed issue with since dates being too old.
parent
0cc484fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestCommitsApi.java
View file @
7268fef0
...
...
@@ -6,6 +6,7 @@ import org.gitlab4j.api.models.Commit;
import
org.gitlab4j.api.models.CommitRef
;
import
org.gitlab4j.api.models.Diff
;
import
org.gitlab4j.api.models.Project
;
import
org.gitlab4j.api.utils.ISO8601
;
import
org.junit.Before
;
import
org.junit.BeforeClass
;
import
org.junit.FixMethodOrder
;
...
...
@@ -13,6 +14,8 @@ import org.junit.Test;
import
org.junit.runners.MethodSorters
;
import
javax.ws.rs.core.Response
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -75,6 +78,7 @@ public class TestCommitsApi {
}
if
(
problems
.
isEmpty
())
{
gitLabApi
=
new
GitLabApi
(
ApiVersion
.
V4
,
TEST_HOST_URL
,
TEST_PRIVATE_TOKEN
);
try
{
...
...
@@ -112,11 +116,11 @@ public class TestCommitsApi {
}
@Test
public
void
testComments
()
throws
GitLabApiException
{
public
void
testComments
()
throws
GitLabApiException
,
ParseException
{
assertNotNull
(
testProject
);
List
<
Commit
>
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
new
Date
(
0
),
new
Date
());
List
<
Commit
>
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
ISO8601
.
toDate
(
"2000-01-01"
),
new
Date
());
assertNotNull
(
commits
);
assertTrue
(
commits
.
size
()
>
0
);
...
...
@@ -131,19 +135,20 @@ public class TestCommitsApi {
}
@Test
public
void
testCommitsSince
()
throws
GitLabApiException
{
public
void
testCommitsSince
()
throws
GitLabApiException
,
ParseException
{
assertNotNull
(
testProject
);
Date
since
=
ISO8601
.
toDate
(
"2000-01-01"
);
List
<
Commit
>
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
new
Date
(),
null
);
assertNotNull
(
commits
);
assertTrue
(
commits
.
isEmpty
());
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
new
Date
(
0
)
,
new
Date
());
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
since
,
new
Date
());
assertNotNull
(
commits
);
assertTrue
(
commits
.
size
()
>
0
);
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
new
Date
(
0
)
,
new
Date
(),
1
,
10
);
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
since
,
new
Date
(),
1
,
10
);
assertNotNull
(
commits
);
assertTrue
(
commits
.
size
()
>
0
);
...
...
@@ -151,7 +156,7 @@ public class TestCommitsApi {
assertNotNull
(
pager
);
assertTrue
(
pager
.
getTotalItems
()
==
0
);
pager
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
new
Date
(
0
)
,
null
,
10
);
pager
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
since
,
null
,
10
);
assertNotNull
(
pager
);
assertTrue
(
pager
.
getTotalItems
()
>
0
);
}
...
...
@@ -170,12 +175,12 @@ public class TestCommitsApi {
}
@Test
public
void
testCommitsSinceWithPath
()
throws
GitLabApiException
{
public
void
testCommitsSinceWithPath
()
throws
GitLabApiException
,
ParseException
{
assertNotNull
(
testProject
);
List
<
Commit
>
commits
=
gitLabApi
.
getCommitsApi
().
getCommits
(
testProject
.
getId
(),
null
,
new
Date
(
0
),
new
Date
(),
TEST_PROJECT_SUBDIRECTORY_PATH
);
testProject
.
getId
(),
null
,
ISO8601
.
toDate
(
"2000-01-01"
),
new
Date
(),
TEST_PROJECT_SUBDIRECTORY_PATH
);
assertNotNull
(
commits
);
assertTrue
(
commits
.
size
()
>
0
);
}
...
...
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