### Question:
DateTimeFormatterUtil { public static Object stringToZonedDateTime(String value, String dateFormat, ZoneId defaultTimeZone) { try { ZonedDateTime zdt = ZonedDateTime.parse(value); logger.info("Parsed {} to ZonedDateTime {}", value, zdt.toString()); return zdt; } catch (DateTimeParseException e) { logger.warn("Unable to parse {} as ZonedDateTime type due to invalid date format, " + "Falling back to LocalDateTime using timezone {}", value, defaultTimeZone); } return stringToDateTime(value, dateFormat, defaultTimeZone); } private  DateTimeFormatterUtil(); static LocalDate stringToLocalDate(String value, String dateFormat,
                                              ZoneId defaultTimeZone); static Object stringToZonedDateTime(String value, String dateFormat, ZoneId defaultTimeZone); static Object stringToDateTime(String value, String dateFormat, ZoneId defaultTimeZone); static LocalDate bigDecimalToLocalDate(BigDecimal value, ZoneId defaultTimeZone); static LocalDateTime bigDecimalToLocalDateTime(BigDecimal value, ZoneId defaultTimeZone); static String inferDateTimeFormat(String value); static long packDateTimeWithZone(ZonedDateTime zdt); static long packDateTimeWithZone(long millisUtc, String zoneId); static ZonedDateTime constructZonedDateTime(long dateTimeWithTimeZone);  }### Answer:
@Test public void stringToZonedDateTimeTest() { LocalDateTime localDateTimeExpected = LocalDateTime.of(2015, 12, 21, 17, 42, 34, 0); ZonedDateTime expected = ZonedDateTime.of(localDateTimeExpected, ZoneId.of("-05:00")); assertEquals(expected, DateTimeFormatterUtil.stringToZonedDateTime("2015-12-21T17:42:34-05:00", null, null)); assertEquals(localDateTimeExpected, DateTimeFormatterUtil.stringToZonedDateTime("2015-12-21T17:42:34", "yyyy-MM-dd'T'HH:mm:ss", ZoneId.of("UTC"))); }