@Test
public void testFindNearestSuccessorForTimestampWithStartTimestampGreaterThanFirstTimestampAndLessThanLastTimestampInChronology() {

    Set<Timestamp> timestamps = new LinkedHashSet<Timestamp>();
    timestamps.add(Timestamp.fromMicros(1000L));
    for (int i = 0; i < Random.getScaleCount(); i++) {
        long increment = 0;
        while (increment == 0) {
            increment = Math.abs(Random.getScaleCount()) + 100L;
        }
        timestamps.add(Timestamp.fromMicros(
                Iterables.getLast(timestamps).getMicros() + increment));
    }
    Timestamp abitrary = Iterables.get(timestamps, timestamps.size() / 3);
    Timestamp abitrarySuccessor = Iterables.get(timestamps,
            timestamps.size() / 3 + 1);
    Timestamp startTimestamp = Timestamp.fromMicros(
            (abitrary.getMicros() + abitrarySuccessor.getMicros()) / 2);
    Assert.assertEquals(timestamps.size() / 3 + 1, Timestamps
            .findNearestSuccessorForTimestamp(timestamps, startTimestamp));
}