DateRange implements Comparable<DateRange> { public DateRange rounded(long interval) { if (interval <= 0) { return this; } return new DateRange(start - start % interval, end - (end % interval)); } DateRange(long start, long end); long start(); long getStart(); long end(); long getEnd(); @Override int hashCode(); @Override boolean equals(final Object o); @JsonIgnore boolean isEmpty(); @JsonIgnore boolean isNotEmpty(); long diff(); DateRange rounded(long interval); boolean overlap(DateRange other); @Override int compareTo(DateRange other); DateRange join(DateRange other); boolean contains(long t); DateRange modify(DateRange range); DateRange modify(long start, long end); DateRange start(long start); DateRange end(long end); DateRange shift(long extent); @Override String toString(); @JsonCreator static DateRange create(
        @JsonProperty(value = "start", required = true) Long start,
        @JsonProperty(value = "end", required = true) Long end
    ); static DateRange now(long now); static DateRange now(Clock clock); void hashTo(final ObjectHasher hasher);  }
@Test public void testRounded() { final DateRange range = new DateRange(0, 1100); assertEquals(new DateRange(0, 1000), range.rounded(1000)); }
@Test public void testRoundedIgnoreBadArgument() { final DateRange range = new DateRange(0, 0); assertTrue(range == range.rounded(-1)); }