@Test
public void aggregateByWithBatchSize()
{

    Function2<Integer, Integer, Integer> sumAggregator = new Function2<Integer, Integer, Integer>()
    {
        public Integer value(Integer aggregate, Integer value)
        {
            return aggregate + value;
        }
    };
    MutableList<Integer> list = LazyIterate.adapt(Collections.nCopies(1000, 1))
            .concatenate(Collections.nCopies(2000, 2))
            .concatenate(Collections.nCopies(3000, 3))
            .toList()
            .shuffleThis();
    MapIterable<String, Integer> aggregation =
            FJIterate.aggregateBy(list, Functions.getToString(), INTEGER_NEW, sumAggregator, 100);
    Assert.assertEquals(1000, aggregation.get("1").intValue());
    Assert.assertEquals(4000, aggregation.get("2").intValue());
    Assert.assertEquals(9000, aggregation.get("3").intValue());
}