public void testRangeMapper60m() throws Exception {
int baseMillis = 6500000;
int hrs = 10;
int endMillis = baseMillis + 3600000 * hrs;
//Map of every 60m(coarser gran) in this time range, mapped to iterable of 20m sub-ranges that get rolled up
Map<Range, Iterable<Range>> retMap = Range.mapFinerRanges(Granularity.MIN_60, new Range(baseMillis, endMillis));
Assert.assertEquals(retMap.entrySet().size(), 11);
for(Map.Entry<Range,Iterable<Range>> entry : retMap.entrySet()) {
Range coarserSubRange = entry.getKey();
int iterValCount = 0;
Iterable<Range> subranges = entry.getValue();
for (Range subrange : subranges) {
if(iterValCount == 0) {
//Start point of coarser range is equal to start point of 1st 20m sub-range
Assert.assertEquals(coarserSubRange.getStart(), subrange.getStart());
}
iterValCount++;
if(iterValCount == 3) {
Assert.assertEquals(coarserSubRange.getStop() - 1, subrange.getStop());
}
}
//Every 60m range gets divided into 3 20m sub-ranges
Assert.assertEquals(iterValCount, 3);
}