File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
main/java/com/amazonaws/transform
test/java/com/amazonaws/transform Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ public static ByteJsonUnmarshaller getInstance() {
249249 */
250250 public static class DateJsonUnmarshaller implements Unmarshaller <Date , JsonUnmarshallerContext > {
251251 private static final int DATE_MULTIPLIER = 1000 ;
252- private final TimestampFormat format ;
252+ final TimestampFormat format ;
253253
254254 private DateJsonUnmarshaller (TimestampFormat format ) {
255255 this .format = format ;
@@ -286,10 +286,7 @@ public Date unmarshall(JsonUnmarshallerContext unmarshallerContext) throws Excep
286286 * @return the instance.
287287 */
288288 public static DateJsonUnmarshaller getInstance () {
289- if (instance == null ) {
290- instance = new DateJsonUnmarshaller (TimestampFormat .UNIX_TIMESTAMP );
291- }
292- return instance ;
289+ return getInstance (TimestampFormat .UNIX_TIMESTAMP );
293290 }
294291
295292 /**
Original file line number Diff line number Diff line change @@ -256,6 +256,15 @@ public void testDateRfc822JsonUnmarshaller() throws Exception {
256256 assertEquals (unmarshalledDate .getTime (), date .getTime ());
257257 }
258258
259+ @ Test
260+ public void defaultFunctionAlwaysReturnsUnixTimestampUnmarshaller () {
261+ SimpleTypeJsonUnmarshallers .DateJsonUnmarshaller first =
262+ SimpleTypeJsonUnmarshallers .DateJsonUnmarshaller .getInstance (TimestampFormat .ISO_8601 );
263+ SimpleTypeJsonUnmarshallers .DateJsonUnmarshaller second =
264+ SimpleTypeJsonUnmarshallers .DateJsonUnmarshaller .getInstance ();
265+ assertEquals (TimestampFormat .UNIX_TIMESTAMP , second .format );
266+ }
267+
259268 @ Test
260269 public void testDoubleJsonUnmarshaller () throws Exception {
261270 Double dub = new Double (5.5 );
You can’t perform that action at this time.
0 commit comments