@Test
public void testCompareTo() throws ParseException {

    final TimeValue tv1 = TimeValue.ofMilliseconds(1000L);
    final TimeValue tv2 = TimeValue.ofMilliseconds(1001L);
    final TimeValue tv3 = TimeValue.ofMilliseconds(1000L);
    final TimeValue tv4 = TimeValue.ofSeconds(1L);
    final TimeValue tv5 = TimeValue.ofSeconds(60L);
    final TimeValue tv6 = TimeValue.ofMinutes(1L);
    Assert.assertThat(tv1.compareTo(tv1) == 0, CoreMatchers.equalTo(true));
    Assert.assertThat(tv1.compareTo(tv2) < 0, CoreMatchers.equalTo(true));
    Assert.assertThat(tv1.compareTo(tv3) == 0, CoreMatchers.equalTo(true));
    Assert.assertThat(tv1.compareTo(tv4) == 0, CoreMatchers.equalTo(true));
    Assert.assertThat(tv1.compareTo(tv5) < 0, CoreMatchers.equalTo(true));
    Assert.assertThat(tv6.compareTo(tv5) == 0, CoreMatchers.equalTo(true));
    Assert.assertThat(tv6.compareTo(tv4) > 0, CoreMatchers.equalTo(true));
    try {
        tv1.compareTo(null);
        Assert.fail("NullPointerException expected");
    } catch (final NullPointerException expected) {
    }
}