Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
20be3766
Commit
20be3766
authored
Mar 27, 2015
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-898: Adding unit test that tests for the problem.
parent
8ce12c9f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
XMPPDateTimeFormatTest.java
...st/java/org/jivesoftware/util/XMPPDateTimeFormatTest.java
+43
-0
No files found.
src/test/java/org/jivesoftware/util/XMPPDateTimeFormatTest.java
View file @
20be3766
package
org
.
jivesoftware
.
util
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
...
...
@@ -27,4 +28,46 @@ public class XMPPDateTimeFormatTest {
String
date
=
df
.
format
(
parsedDate
);
assertEquals
(
date
,
"2013-01-25T18:07:22.768+0000"
);
}
@Test
public
void
testFormatNoSecondFractions
()
throws
Exception
{
// Setup fixture
final
String
testValue
=
"2015-03-19T22:54:15+00:00"
;
// Thu, 19 Mar 2015 22:54:15 GMT
// Execute system under test
final
Date
result
=
xmppDateTimeFormat
.
parseString
(
testValue
);
// Verify results
long
expected
=
1426805655000L
;
// Epoch value of Thu, 19 Mar 2015 22:54:15 GMT
assertEquals
(
expected
,
result
.
getTime
()
);
}
@Test
public
void
testFormatThreeSecondFractions
()
throws
Exception
{
// Setup fixture
final
String
testValue
=
"2015-03-19T22:54:15.841+00:00"
;
// Thu, 19 Mar 2015 22:54:15.841 GMT
// Execute system under test
final
Date
result
=
xmppDateTimeFormat
.
parseString
(
testValue
);
// Verify results
long
expected
=
1426805655841L
;
// Epoch value of Thu, 19 Mar 2015 22:54:15.841 GMT
assertEquals
(
expected
,
result
.
getTime
()
);
}
@Test
public
void
testFormatManySecondFractions
()
throws
Exception
{
// Setup fixture
final
String
testValue
=
"2015-03-19T22:54:15.841473+00:00"
;
// Thu, 19 Mar 2015 22:54:15.841473 GMT
// Execute system under test
final
Date
result
=
xmppDateTimeFormat
.
parseString
(
testValue
);
// Verify results
long
expected
=
1426805655841L
;
// Epoch value of Thu, 19 Mar 2015 22:54:15 GMT
assertEquals
(
expected
,
result
.
getTime
()
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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