Skip to content

Commit 5e28e10

Browse files
committed
Add (passing) test for #1153
1 parent 3614d6c commit 5e28e10

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.fasterxml.jackson.databind.deser.jdk;
2+
3+
import java.util.Date;
4+
import java.util.TimeZone;
5+
6+
import com.fasterxml.jackson.databind.*;
7+
8+
public class DateDeserializationTZ1153Test extends BaseMapTest
9+
{
10+
private final ObjectMapper MAPPER = newJsonMapper();
11+
12+
// [databind#1153]
13+
public void testWithTimezones1153() throws Exception
14+
{
15+
for (String tzStr : new String[] {
16+
"UTC", "CET", "America/Los_Angeles", "Australia/Melbourne"
17+
}) {
18+
_testWithTimeZone(TimeZone.getTimeZone(tzStr));
19+
}
20+
}
21+
22+
void _testWithTimeZone(TimeZone tz) throws Exception
23+
{
24+
ObjectReader r = MAPPER.readerFor(Date.class)
25+
.with(tz);
26+
27+
String time = "2016-01-01T17:00:00.000Z";
28+
long correctTime = 1451667600000l;
29+
Date dateAccordingToJackson = r.readValue(quote(time));
30+
31+
assertEquals("ISO8601 decoding mismatch " + tz,
32+
correctTime, dateAccordingToJackson.getTime());
33+
}
34+
}

0 commit comments

Comments
 (0)