CustomTimeBucket implements Serializable, Comparable<CustomTimeBucket> { public long roundDown(long timestamp) { if (timeBucket == TimeBucket.ALL) { return 0; } return (timestamp / numMillis) * numMillis; } private  CustomTimeBucket();  CustomTimeBucket(String timeBucketText);  CustomTimeBucket(TimeBucket timeBucket, long count);  CustomTimeBucket(TimeBucket timeBucket); boolean isUnit(); TimeBucket getTimeBucket(); long getCount(); long getNumMillis(); long toMillis(long multCount); long roundDown(long timestamp); String getText(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(CustomTimeBucket other); static final String TIME_BUCKET_NAME_REGEX; static final Pattern TIME_BUCKET_NAME_PATTERN; }
@Test public void roundDownTest() { CustomTimeBucket customTimeBucket = new CustomTimeBucket("5m"); long expected = 5 * 60 * 1000; long val = expected + 300; Assert.assertEquals(expected, customTimeBucket.roundDown(val)); }