public static Long convertTimestampToMillis(String timeStr) {
    long millis = 0L;
    if (timeStr != null) {
      try {
        millis = Instant.parse(timeStr).toEpochMilli();
      } catch (Exception e) {
        // rethrowing with more contextual information
        throw new IllegalArgumentException("Invalid time spec '" + timeStr + "' (Valid example: "
            + "'2022-08-09T12:31:38.222Z')", e);
      }
    }
    return millis;
  }
@Test
  public void testConvertDateTimeToMillis() {
    assertEquals((long) TimeUtils.convertTimestampToMillis("2022-08-09T12:31:38.222Z"), 1660048298222L);
    Assert.assertThrows(IllegalArgumentException.class, () -> TimeUtils
        .convertTimestampToMillis("2022-08-09X12:31:38.222Z"));
    assertEquals((long) TimeUtils.convertTimestampToMillis(null), 0L);
  }