ExpiryCheckHandler { public static DateTime parseDateTime(String datetime) { return dfISO8601Parser.parseDateTime(datetime); } private  ExpiryCheckHandler(); static void updateServerTimestampHeader(HttpRequest request); static void updateServerTimestampHeader(MultiMap headers); static Integer getExpireAfter(MultiMap headers); static Optional<Integer> getExpireAfterConcerningCaseOfCorruptHeaderAndInfinite(MultiMap headers); static Integer getQueueExpireAfter(MultiMap headers); static boolean isExpired(MultiMap headers, Long timestamp); static DateTime getExpirationTime(int expireAfter); static Optional<String> getExpirationTimeAsString(int expireAfter); static DateTime parseDateTime(String datetime); static String printDateTime(DateTime datetime); static void setExpireAfter(HttpServerRequest request, int expireAfter); static void setQueueExpireAfter(MultiMap headers, int queueExpireAfter); static final String SERVER_TIMESTAMP_HEADER; static final String EXPIRE_AFTER_HEADER; static final String QUEUE_EXPIRE_AFTER_HEADER; }
@Test public void parseDateTimeTest() { DateTime parsed = ExpiryCheckHandler.parseDateTime("2020-03-05T10:21:27.021+01:00"); Assert.assertEquals(1583400087021L, parsed.getMillis()); DateTime parsedWithoutTimezone = ExpiryCheckHandler.parseDateTime("2020-03-05T10:21:27.021"); Assert.assertEquals(1583400087021L, parsedWithoutTimezone.getMillis()); }