@Test
public void testDateTimeToUTCTimestamp() {

    LOG.info("testDateTimeToUTCTimestamp");
    // Valid values.
    final DateTime dt1 = DateTime.parse("1960-10-04T08:15:30-05:00").withZone(DateTimeZone.UTC);
    final int t1 = UTCTime.dateTimeToUTCTimestamp(dt1);
    Assert.assertEquals(-291638670, t1);
    final DateTime dt2 = DateTime.parse("2000-10-04T08:15:30-05:00").withZone(DateTimeZone.UTC);
    final int t2 = UTCTime.dateTimeToUTCTimestamp(dt2);
    Assert.assertEquals(970665330, t2);
    final DateTime dt3 = DateTime.parse("2020-10-04T08:15:30-05:00").withZone(DateTimeZone.UTC);
    final int t3 = UTCTime.dateTimeToUTCTimestamp(dt3);
    Assert.assertEquals(1601817330, t3);
    final DateTime dt4 = UTCTime.MIN_TIMESTAMP_DATE;
    final int t4 = UTCTime.dateTimeToUTCTimestamp(dt4);
    Assert.assertEquals(-2147483646, t4);
    final DateTime dt5 = UTCTime.MAX_TIMESTAMP_DATE;
    final int t5 = UTCTime.dateTimeToUTCTimestamp(dt5);
    Assert.assertEquals(2147483647, t5);
    try {
        final DateTime dt6 = UTCTime.MIN_TIMESTAMP_DATE.minusSeconds(1);
        UTCTime.dateTimeToUTCTimestamp(dt6);
        Assert.fail("Expected to fail because it is less than minimum allowed date");
    } catch (final IllegalArgumentException ignored) {
        // Expected.
    }
    try {
        final DateTime dt7 = UTCTime.MAX_TIMESTAMP_DATE.plusSeconds(1);
        UTCTime.dateTimeToUTCTimestamp(dt7);
        Assert.fail("Expected to fail because it is more than maximum allowed date");
    } catch (final IllegalArgumentException ignored) {
        // Expected.
    }
}