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
ac739292
Commit
ac739292
authored
Apr 18, 2019
by
Greg Messner
Browse files
Added tests for UTC zone name (#333).
parent
0824d6c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/org/gitlab4j/api/TestISO8601.java
View file @
ac739292
...
...
@@ -12,6 +12,7 @@ public class TestISO8601 {
private
static
final
String
SPACEY_GITLAB_DATE
=
"2018-03-12 10:16:46 +0700"
;
private
static
final
String
ISO8601_GITLAB_DATE
=
"2018-03-12T10:16:46+0700"
;
private
static
final
String
SPACEY_GITLAB_UTC_DATE
=
"2018-03-12 03:16:46 UTC"
;
private
static
final
String
DATE_ONLY
=
"2018-03-12"
;
private
static
final
String
DATE_AT_MIDNIGHT
=
"2018-03-12T00:00:00Z"
;
...
...
@@ -22,6 +23,7 @@ public class TestISO8601 {
private
static
final
String
ISO8601_DATE_MSEC
=
"2018-03-12T10:16:46.123Z"
;
private
static
final
String
ISO8601_DATE_OFFSET_COLON
=
"2018-03-12T10:16:46.123+00:00"
;
private
static
final
String
ISO8601_GITLAB_DATE_MSEC
=
"2018-03-12T03:16:46.123-0700"
;
private
static
final
String
SPACEY_GITLAB_UTC_DATE_MSEC
=
"2018-03-12 10:16:46.123 UTC"
;
@Test
public
void
testGitlabDateParse
()
throws
ParseException
{
...
...
@@ -30,6 +32,20 @@ public class TestISO8601 {
assertEquals
(
spaceyDate
,
gitlabDate
);
}
@Test
public
void
testGitlabUtcDateParse
()
throws
ParseException
{
Date
spaceyDate
=
ISO8601
.
toDate
(
SPACEY_GITLAB_UTC_DATE
);
Date
gitlabDate
=
ISO8601
.
toDate
(
ISO8601_GITLAB_DATE
);
assertEquals
(
spaceyDate
,
gitlabDate
);
}
@Test
public
void
testGitlabMsecUtcDateParse
()
throws
ParseException
{
Date
spaceyDate
=
ISO8601
.
toDate
(
SPACEY_GITLAB_UTC_DATE_MSEC
);
Date
msecDate
=
ISO8601
.
toDate
(
ISO8601_DATE_MSEC
);
assertEquals
(
spaceyDate
,
msecDate
);
}
@Test
public
void
testDateOnlyParse
()
throws
ParseException
{
Date
dateOnly
=
ISO8601
.
toDate
(
DATE_ONLY
);
...
...
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