From 39f1adff6e73efe18202a80f28f5d7ba0f4a0319 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Tue, 10 Oct 2017 14:22:38 -0700 Subject: [PATCH] test cleanup --- .../ser/jdk/DateSerializationTest.java | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/DateSerializationTest.java b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/DateSerializationTest.java index 857f3940e6..07605755a5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/ser/jdk/DateSerializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/ser/jdk/DateSerializationTest.java @@ -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+0200"); - serialize( mapper, judate(1970, 1, 1, 00, 00, 00, 0, "UTC"), "1970-01-01T02:00:00.000+0200"); + serialize( mapper, judate(1970, 1, 1, 00, 00, 00, 0, "UTC"), "1970-01-01T02:00:00.000+0200"); } /** @@ -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); + } }