### Question:
DateTimeFormatterUtil { public static Object stringToDateTime(String value, String dateFormat, ZoneId defaultTimeZone) { if (StringUtils.isNullOrEmpty(dateFormat)) { logger.warn("Unable to parse {} as DateTime type due to invalid date format", value); return null; } Date dateTransformedValue = stringToDate(value, dateFormat); if (dateTransformedValue == null) { return null; } return dateTransformedValue.toInstant() .atZone(defaultTimeZone) .toLocalDateTime(); } 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 stringTolDateTimeTest() { LocalDateTime expected = LocalDateTime.of(2020, 2, 27, 0, 2, 27); assertEquals(expected, DateTimeFormatterUtil.stringToDateTime("00:02:27S2020-02-27", "HH:mm:ss'S'yyyy-MM-dd", DEFAULT_TIME_ZONE)); assertNull(DateTimeFormatterUtil.stringToDateTime("00:02:27S2020-02-27", null, DEFAULT_TIME_ZONE)); }
@Test public void stringToDateTimeTestCustomerConfiguredFormatFail() { assertNull(DateTimeFormatterUtil.stringToDateTime("00:02:27S2020---02-27", "HH:mm:ss'S'yyyy-MM-dd", DEFAULT_TIME_ZONE)); }