@Test
public void groupByWithInterval()
{

    LazyIterable<Integer> iterable = Interval.oneTo(1000).concatenate(Interval.oneTo(1000)).concatenate(Interval.oneTo(1000));
    Multimap<String, Integer> expected = iterable.toBag().groupBy(Functions.getToString());
    Multimap<String, Integer> expectedAsSet = iterable.toSet().groupBy(Functions.getToString());
    Multimap<String, Integer> result1 = FJIterate.groupBy(iterable.toList(), Functions.getToString(), 100);
    Multimap<String, Integer> result2 = FJIterate.groupBy(iterable.toList(), Functions.getToString());
    Multimap<String, Integer> result3 = FJIterate.groupBy(iterable.toSet(), Functions.getToString(), SynchronizedPutUnifiedSetMultimap.<String, Integer>newMultimap(), 100);
    Multimap<String, Integer> result4 = FJIterate.groupBy(iterable.toSet(), Functions.getToString(), SynchronizedPutUnifiedSetMultimap.<String, Integer>newMultimap());
    Multimap<String, Integer> result5 = FJIterate.groupBy(iterable.toSortedSet(), Functions.getToString(), SynchronizedPutUnifiedSetMultimap.<String, Integer>newMultimap(), 100);
    Multimap<String, Integer> result6 = FJIterate.groupBy(iterable.toSortedSet(), Functions.getToString(), SynchronizedPutUnifiedSetMultimap.<String, Integer>newMultimap());
    Multimap<String, Integer> result7 = FJIterate.groupBy(iterable.toBag(), Functions.getToString(), SynchronizedPutHashBagMultimap.<String, Integer>newMultimap(), 100);
    Multimap<String, Integer> result8 = FJIterate.groupBy(iterable.toBag(), Functions.getToString(), SynchronizedPutHashBagMultimap.<String, Integer>newMultimap());
    Multimap<String, Integer> result9 = FJIterate.groupBy(iterable.toList().toImmutable(), Functions.getToString());
    Assert.assertEquals(expected, HashBagMultimap.newMultimap(result1));
    Assert.assertEquals(expected, HashBagMultimap.newMultimap(result2));
    Assert.assertEquals(expected, HashBagMultimap.newMultimap(result9));
    Assert.assertEquals(expectedAsSet, result3);
    Assert.assertEquals(expectedAsSet, result4);
    Assert.assertEquals(expectedAsSet, result5);
    Assert.assertEquals(expectedAsSet, result6);
    Assert.assertEquals(expected, result7);
    Assert.assertEquals(expected, result8);
}