Skip to content

Commit

Permalink
Merge branch '2.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 10, 2017
2 parents b6aa97c + 39f1adf commit b1aa8e3
Showing 1 changed file with 15 additions and 17 deletions.
Expand Up @@ -131,7 +131,7 @@ public void testDateISO8601_customTZ() throws IOException
mapper.setTimeZone(TimeZone.getTimeZone("GMT+2"));

serialize( mapper, judate(1970, 1, 1, 00, 00, 00, 0, "GMT+2"), "1970-01-01T00:00:00.000+02:00");
serialize( mapper, judate(1970, 1, 1, 00, 00, 00, 0, "UTC"), "1970-01-01T02:00:00.000+02:00");
serialize( mapper, judate(1970, 1, 1, 00, 00, 00, 0, "UTC"), "1970-01-01T02:00:00.000+02:00");
}

/**
Expand Down Expand Up @@ -318,20 +318,18 @@ public void testFormatWithoutPattern() throws Exception
String json = mapper.writeValueAsString(new DateAsDefaultBeanWithTimezone(0L));
assertEquals(aposToQuotes("{'date':'1970-01-01X01:00:00'}"), json);
}



private static Date judate(int year, int month, int day, int hour, int minutes, int seconds, int millis, String tz) {
Calendar cal = Calendar.getInstance();
cal.set(year, month-1, day, hour, minutes, seconds);
cal.set(Calendar.MILLISECOND, millis);
cal.setTimeZone(TimeZone.getTimeZone(tz));

return cal.getTime();
}

private void serialize(ObjectMapper mapper, Object date, String expected) throws IOException {
String actual = mapper.writeValueAsString(date);
Assert.assertEquals(quote(expected), actual);
}

private static Date judate(int year, int month, int day, int hour, int minutes, int seconds, int millis, String tz) {
Calendar cal = Calendar.getInstance();
cal.set(year, month-1, day, hour, minutes, seconds);
cal.set(Calendar.MILLISECOND, millis);
cal.setTimeZone(TimeZone.getTimeZone(tz));

return cal.getTime();
}

private void serialize(ObjectMapper mapper, Object date, String expected) throws IOException {
String actual = mapper.writeValueAsString(date);
Assert.assertEquals(quote(expected), actual);
}
}

0 comments on commit b1aa8e3

Please sign in to comment.