### Question:
DateTimeFormatterUtil { public static String inferDateTimeFormat(String value) { for (String datetimeFormat : SUPPORTED_DATETIME_FORMAT) { try { DateUtils.parseDate(value, datetimeFormat); logger.info("Inferred format {} for value {}", datetimeFormat, value); return datetimeFormat; } catch (ParseException ex) { continue; } } logger.warn("Failed to infer format for {}", value); return null; } 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 inferDateTimeFormatTest() { String inferredDateFormat = DateTimeFormatterUtil.inferDateTimeFormat("2020-02-27"); assertEquals("yyyy-MM-dd", inferredDateFormat); inferredDateFormat = DateTimeFormatterUtil.inferDateTimeFormat("2020-02-27T00:02:27"); assertEquals("yyyy-MM-dd'T'HH:mm:ss", inferredDateFormat); inferredDateFormat = DateTimeFormatterUtil.inferDateTimeFormat("2020-02-27T00:02:27Z"); assertEquals("yyyy-MM-dd'T'HH:mm:ssZZ", inferredDateFormat); inferredDateFormat = DateTimeFormatterUtil.inferDateTimeFormat("2020-02-27T00:02:27-05:00"); assertEquals("yyyy-MM-dd'T'HH:mm:ssZZ", inferredDateFormat); inferredDateFormat = DateTimeFormatterUtil.inferDateTimeFormat("20200227T000227"); assertEquals("yyyyMMdd'T'HHmmss", inferredDateFormat); inferredDateFormat = DateTimeFormatterUtil.inferDateTimeFormat("20200227T000227Z"); assertEquals("yyyyMMdd'T'HHmmssZZ", inferredDateFormat); inferredDateFormat = DateTimeFormatterUtil.inferDateTimeFormat("2020202020202020202020"); assertNull(inferredDateFormat); }