@Test
  public void testTimeRange() {
    Random rand = new Random();
    long referenceTimeInMs = rand.nextInt(10000) + 10000;
    TimeRange timeRangeWithNoErrorMargin = new TimeRange(referenceTimeInMs, 0L);
    long errorMarginInMs = rand.nextInt(10000);
    TimeRange timeRangeWithErrorMargin = new TimeRange(referenceTimeInMs, errorMarginInMs);
    assertEquals("Start time and end time should be equal for TimeRange with no error margin",
        timeRangeWithNoErrorMargin.getStartTimeInMs(), timeRangeWithNoErrorMargin.getEndTimeInMs());
    assertEquals("TimeRange with no error margin is constructed incorrectly", referenceTimeInMs,
        timeRangeWithNoErrorMargin.getStartTimeInMs());
    assertEquals("Start time of TimeRange with error margin is incorrect", referenceTimeInMs - errorMarginInMs,
        timeRangeWithErrorMargin.getStartTimeInMs());
    assertEquals("End time of TimeRange with error margin is incorrect", referenceTimeInMs + errorMarginInMs,
        timeRangeWithErrorMargin.getEndTimeInMs());
  }
Tests the constructor and getters of TimeRange when provided with legal arguments.
ambry-store/src/test/java/com/github/ambry/store/TimeRangeTest.java