Source:
@Test public void testInduceGroupingType() { ImmutableBitSet groupSet = ImmutableBitSet.of(1, 2, 4, 5); List<ImmutableBitSet> groupSets = Lists.newArrayList(); groupSets.add(groupSet); assertEquals(Aggregate.Group.SIMPLE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(groupSet.powerSet()); assertEquals(Aggregate.Group.CUBE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); groupSets.add(ImmutableBitSet.of(1, 2, 4, 5)); groupSets.add(ImmutableBitSet.of(1, 2, 4)); groupSets.add(ImmutableBitSet.of(1, 2)); groupSets.add(ImmutableBitSet.of(1)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.ROLLUP, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); groupSets.add(ImmutableBitSet.of(1, 2, 4, 5)); groupSets.add(ImmutableBitSet.of(1, 2, 4)); groupSets.add(ImmutableBitSet.of(1, 2)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); groupSets.add(ImmutableBitSet.of(1, 2, 4, 5)); groupSets.add(ImmutableBitSet.of(1, 2, 4)); groupSets.add(ImmutableBitSet.of(1, 2)); groupSets.add(ImmutableBitSet.of(1)); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); groupSets.add(ImmutableBitSet.of(1, 2, 5)); groupSets.add(ImmutableBitSet.of(1, 2, 4)); groupSets.add(ImmutableBitSet.of(1, 2)); groupSets.add(ImmutableBitSet.of(1)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); }

Target:
@Test public void testInduceGroupingType() { ImmutableBitSet groupSet = ImmutableBitSet.of(1, 2, 4, 5); List<ImmutableBitSet> groupSets = Lists.newArrayList(); groupSets.add(groupSet); assertEquals(Aggregate.Group.SIMPLE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(groupSet.powerSet()); assertEquals(Aggregate.Group.CUBE, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); groupSets.add(ImmutableBitSet.of(1, 2, 4, 5)); groupSets.add(ImmutableBitSet.of(1, 2, 4)); groupSets.add(ImmutableBitSet.of(1, 2)); groupSets.add(ImmutableBitSet.of(1)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.ROLLUP, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); groupSets.add(ImmutableBitSet.of(1, 2, 4, 5)); groupSets.add(ImmutableBitSet.of(1, 2, 4)); groupSets.add(ImmutableBitSet.of(1, 2)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); groupSets.add(ImmutableBitSet.of(1, 2, 4, 5)); groupSets.add(ImmutableBitSet.of(1, 2, 4)); groupSets.add(ImmutableBitSet.of(1, 2)); groupSets.add(ImmutableBitSet.of(1)); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); groupSets.add(ImmutableBitSet.of(1, 2, 5)); groupSets.add(ImmutableBitSet.of(1, 2, 4)); groupSets.add(ImmutableBitSet.of(1, 2)); groupSets.add(ImmutableBitSet.of(1)); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); groupSets = Lists.newArrayList(); groupSets.add(ImmutableBitSet.of()); assertEquals(Aggregate.Group.OTHER, Aggregate.Group.induce(groupSet, groupSets)); }