### Question:
DateTimeDetector { public DateTimeDetector() { this(COMMON_DATE_FORMATS, COMMON_DATE_TIME_FORMATS); } DateTimeDetector();  DateTimeDetector(String[] dateFormats, String[] dateTimeFormats); ZoneId getZoneId(); void setZoneId(ZoneId zoneId); String detectPossibleDateTimeString(String text); OffsetDateTime detectDateTimeLeniently(String text); OffsetDateTime detectDateTime(String text); YearMonth detectYearMonth(String text); YearMonth tryParseYearMonthStrictly(String possibleYearMonth); OffsetDateTime detectDate(String text); OffsetDateTime tryParseDateStrictly(String possibleDate); OffsetDateTime parseDateStrictly(String dateStr); OffsetDateTime parseDateTimeStrictly(String dateStr); OffsetDateTime parseDateStrictly(String dateStr, String... formats); Instant parseDateTimeStrictly(String dateStr, Instant defaultValue); boolean containsOldDate(String text, int days, ZoneId zoneId); static final int MIN_DATE_TIME_STR_LENGTH; static final int MIN_YEAR_MONTH_STR_LENGTH; static final int MIN_DATE_STR_LENGTH; static final int MAX_META_STR_LENGTH; static final int MAX_DATE_TIME_STR_LENGTH; static final int MAX_TITLE_LENGTH; static final String[] BAD_DATE_TIME_STRING_CONTAINS; static final int OLD_DATE_DAYS; static final LocalDate CURRENT_DATE; static final long CURRENT_DATE_EPOCH_DAYS; static final int CURRENT_YEAR; static final String CURRENT_YEAR_STR; static final int CURRENT_MONTH; static final int YEAR_LOWER_BOUND; static final List<String> VALID_WORK_YEARS; static final List<String> VALID_WORK_YEARS_SHORT; static final String[] VALID_WORK_YEARS_ARRAY; static final String[] VALID_WORK_YEARS_SHORT_ARRAY; static Set<String> OLD_YEARS; static Set<String> OLD_MONTH; static Pattern OLD_MONTH_URL_DATE_PATTERN; static String[] COMMON_DATE_FORMATS; static String[] COMMON_DATE_TIME_FORMATS; }### Answer:
@Test public void testDateTimeDetector() { DateTimeDetector detector = new DateTimeDetector(); ZoneId zoneId = ZoneId.systemDefault(); String oldTexts[] = { "http: "http: "http: "http: "http: "http: "http: "http: "http: "http: }; for (String text : oldTexts) { OffsetDateTime dateTime = detector.detectDate(text); assertNotNull(text, dateTime); assertTrue(text + ", " + dateTime.toInstant(), detector.containsOldDate(text, 1, zoneId)); } String invalideTexts[] = { "http: "http: "http: "http: "http: }; for (String text : invalideTexts) { assertNull(detector.detectDate(text)); } }