@@ -110,25 +110,25 @@ public void testDateISO8601() throws IOException
110
110
.configure (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS , false )
111
111
.build ();
112
112
113
- serialize ( mapper , judate (1970 , 1 , 1 , 02 , 00 , 00 , 0 , "GMT+2" ), "1970-01-01T00:00:00.000+00:00 " );
114
- serialize ( mapper , judate (1970 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "1970-01-01T00:00:00.000+00:00 " );
115
- serialize (mapper , judate (1970 , 1 , 1 , 02 , 00 , 00 , 0 , "GMT+2" ), "1970-01-01T00:00:00.000+00:00 " );
116
- serialize (mapper , judate (1970 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "1970-01-01T00:00:00.000+00:00 " );
113
+ serialize ( mapper , judate (1970 , 1 , 1 , 02 , 00 , 00 , 0 , "GMT+2" ), "1970-01-01T00:00:00.000Z " );
114
+ serialize ( mapper , judate (1970 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "1970-01-01T00:00:00.000Z " );
115
+ serialize (mapper , judate (1970 , 1 , 1 , 02 , 00 , 00 , 0 , "GMT+2" ), "1970-01-01T00:00:00.000Z " );
116
+ serialize (mapper , judate (1970 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "1970-01-01T00:00:00.000Z " );
117
117
118
118
// 22-Nov-2018, tatu: Also ensure we use padding...
119
- serialize (mapper , judate (911 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "0911-01-01T00:00:00.000+00:00 " );
120
- serialize (mapper , judate (87 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "0087-01-01T00:00:00.000+00:00 " );
121
- serialize (mapper , judate (1 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "0001-01-01T00:00:00.000+00:00 " );
119
+ serialize (mapper , judate (911 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "0911-01-01T00:00:00.000Z " );
120
+ serialize (mapper , judate (87 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "0087-01-01T00:00:00.000Z " );
121
+ serialize (mapper , judate (1 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "0001-01-01T00:00:00.000Z " );
122
122
}
123
123
124
124
// [databind#2167]: beyond year 9999 needs special handling
125
125
public void testDateISO8601_10k () throws IOException
126
126
{
127
127
ObjectWriter w = MAPPER .writer ()
128
128
.without (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS );
129
- serialize (w , judate (10204 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "+10204-01-01T00:00:00.000+00:00 " );
129
+ serialize (w , judate (10204 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "+10204-01-01T00:00:00.000Z " );
130
130
// and although specification lacks for beyond 5 digits (well, actually even 5...), let's do our best:
131
- serialize (w , judate (123456 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "+123456-01-01T00:00:00.000+00:00 " );
131
+ serialize (w , judate (123456 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "+123456-01-01T00:00:00.000Z " );
132
132
}
133
133
134
134
// [databind#2167]: dates before Common Era (CE), that is, BCE, need special care:
@@ -140,10 +140,10 @@ public void testDateISO8601_BCE() throws IOException
140
140
// First: I _think_ BCE-1 is what you get with year 0, and should become "+0000"
141
141
// and from further back in time, it'll be "-0001" (BCE-2) etc)
142
142
143
- serialize (w , judate (0 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "+0000-01-01T00:00:00.000+00:00 " );
144
- serialize (w , judate (-1 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "-0001-01-01T00:00:00.000+00:00 " );
145
- serialize (w , judate (-49 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "-0049-01-01T00:00:00.000+00:00 " ); // All hail Caesar
146
- serialize (w , judate (-264 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "-0264-01-01T00:00:00.000+00:00 " ); // Carthage FTW?
143
+ serialize (w , judate (0 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "+0000-01-01T00:00:00.000Z " );
144
+ serialize (w , judate (-1 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "-0001-01-01T00:00:00.000Z " );
145
+ serialize (w , judate (-49 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "-0049-01-01T00:00:00.000Z " ); // All hail Caesar
146
+ serialize (w , judate (-264 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "-0264-01-01T00:00:00.000Z " ); // Carthage FTW?
147
147
}
148
148
149
149
/**
@@ -177,8 +177,8 @@ public void testDateISO8601_colonInTZ() throws IOException
177
177
.defaultDateFormat (dateFormat )
178
178
.configure (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS , false )
179
179
.build ();
180
- serialize ( mapper , judate (1970 , 1 , 1 , 02 , 00 , 00 , 0 , "GMT+2" ), "1970-01-01T00:00:00.000+0000 " );
181
- serialize ( mapper , judate (1970 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "1970-01-01T00:00:00.000+0000 " );
180
+ serialize ( mapper , judate (1970 , 1 , 1 , 02 , 00 , 00 , 0 , "GMT+2" ), "1970-01-01T00:00:00.000Z " );
181
+ serialize ( mapper , judate (1970 , 1 , 1 , 00 , 00 , 00 , 0 , "UTC" ), "1970-01-01T00:00:00.000Z " );
182
182
}
183
183
184
184
public void testDateOther () throws IOException
@@ -230,7 +230,7 @@ public void testDatesAsMapKeys() throws IOException
230
230
assertFalse (mapper .isEnabled (SerializationFeature .WRITE_DATE_KEYS_AS_TIMESTAMPS ));
231
231
map .put (new Date (0L ), Integer .valueOf (1 ));
232
232
// by default will serialize as ISO-8601 values...
233
- assertEquals ("{\" 1970-01-01T00:00:00.000+00:00 \" :1}" , mapper .writeValueAsString (map ));
233
+ assertEquals ("{\" 1970-01-01T00:00:00.000Z \" :1}" , mapper .writeValueAsString (map ));
234
234
235
235
// but can change to use timestamps too
236
236
mapper = jsonMapperBuilder ()
@@ -264,7 +264,7 @@ public void testDateWithJsonFormat() throws Exception
264
264
265
265
// and with default (ISO8601) format (databind#1109)
266
266
json = MAPPER .writeValueAsString (new DateAsDefaultStringBean (0L ));
267
- assertEquals ("{\" date\" :\" 1970-01-01T00:00:00.000+00:00 \" }" , json );
267
+ assertEquals ("{\" date\" :\" 1970-01-01T00:00:00.000Z \" }" , json );
268
268
}
269
269
270
270
/**
@@ -313,7 +313,7 @@ public void testDateDefaultShape() throws Exception
313
313
json = MAPPER .writer ()
314
314
.without (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS )
315
315
.writeValueAsString (new DateAsDefaultBean (0L ));
316
- assertEquals (aposToQuotes ("{'date':'1970-01-01T00:00:00.000+00:00 '}" ), json );
316
+ assertEquals (aposToQuotes ("{'date':'1970-01-01T00:00:00.000Z '}" ), json );
317
317
318
318
// Empty @JsonFormat => default to user config
319
319
json = MAPPER .writer ()
@@ -323,7 +323,7 @@ public void testDateDefaultShape() throws Exception
323
323
json = MAPPER .writer ()
324
324
.without (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS )
325
325
.writeValueAsString (new DateAsDefaultBeanWithEmptyJsonFormat (0L ));
326
- assertEquals (aposToQuotes ("{'date':'1970-01-01T00:00:00.000+00:00 '}" ), json );
326
+ assertEquals (aposToQuotes ("{'date':'1970-01-01T00:00:00.000Z '}" ), json );
327
327
328
328
// @JsonFormat with Shape.ANY and pattern => STRING shape, regardless of user config
329
329
json = MAPPER .writer ()
@@ -339,11 +339,11 @@ public void testDateDefaultShape() throws Exception
339
339
json = MAPPER .writer ()
340
340
.with (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS )
341
341
.writeValueAsString (new DateAsDefaultBeanWithLocale (0L ));
342
- assertEquals (aposToQuotes ("{'date':'1970-01-01T00:00:00.000+00:00 '}" ), json );
342
+ assertEquals (aposToQuotes ("{'date':'1970-01-01T00:00:00.000Z '}" ), json );
343
343
json = MAPPER .writer ()
344
344
.without (SerializationFeature .WRITE_DATES_AS_TIMESTAMPS )
345
345
.writeValueAsString (new DateAsDefaultBeanWithLocale (0L ));
346
- assertEquals (aposToQuotes ("{'date':'1970-01-01T00:00:00.000+00:00 '}" ), json );
346
+ assertEquals (aposToQuotes ("{'date':'1970-01-01T00:00:00.000Z '}" ), json );
347
347
348
348
// @JsonFormat with Shape.ANY and timezone => STRING shape, regardless of user config
349
349
json = MAPPER .writer ()
0 commit comments