1);
// test the day boundaries first - going from feb28 to march 1 should
// give 3 bins
TemporalBinningStrategy binStrategy = new TemporalBinningStrategy(
Unit.DAY);
BinRange[] ranges = binStrategy.getNormalizedRanges(new NumericRange(
startCal.getTimeInMillis(),
endCal.getTimeInMillis()));
Assert.assertEquals(
3,
ranges.length);
// now test the month boundaries - adding a day to feb28 for the end
// time should give 1 bin, adding 2 days should give 2 bins
binStrategy = new TemporalBinningStrategy(
Unit.MONTH);
ranges = binStrategy.getNormalizedRanges(new NumericRange(
startCal.getTimeInMillis(),
startCal.getTimeInMillis() + (TemporalBinningStrategy.MILLIS_PER_DAY)));
Assert.assertEquals(
1,
ranges.length);
// add 2 days and now we should end up with 2 bins
ranges = binStrategy.getNormalizedRanges(new NumericRange(
startCal.getTimeInMillis(),
startCal.getTimeInMillis() + (TemporalBinningStrategy.MILLIS_PER_DAY * 2)));
Assert.assertEquals(
2,