@Test
public void testSplit() {

  try {
    SetUtils.split(null, 0);
    Assert.fail("Expected IllegalArgumentException.");
  } catch (IllegalArgumentException e) {
    // expected
  }
  int size = 10;
  List<Set<Integer>> subsets = SetUtils.split(null, size);
  Assert.assertEquals(0, subsets.size());
  subsets = SetUtils.split(Collections.<Integer>emptySet(), size);
  Assert.assertEquals(0, subsets.size());
  subsets = SetUtils.split(Collections.singleton(0), size);
  Assert.assertEquals(1, subsets.size());
  Assert.assertEquals(1, subsets.get(0).size());
  Set<Integer> set = new LinkedHashSet<Integer>(5);
  for(int i = 0; i < 5; i++) {
    set.add(i);
  }
  subsets = SetUtils.split(set, size);
  Assert.assertEquals(1, subsets.size());
  Assert.assertEquals(5, subsets.get(0).size());
  set = new LinkedHashSet<Integer>(10);
  for(int i = 0; i < 10; i++) {
    set.add(i);
  }
  subsets = SetUtils.split(set, size);
  Assert.assertEquals(1, subsets.size());
  Assert.assertEquals(10, subsets.get(0).size());
  set = new LinkedHashSet<Integer>(11);
  for(int i = 0; i < 11; i++) {
    set.add(i);
  }
  subsets = SetUtils.split(set, size);
  Assert.assertEquals(2, subsets.size());
  Assert.assertEquals(10, subsets.get(0).size());
  Assert.assertEquals(1, subsets.get(1).size());
  set = new LinkedHashSet<Integer>(20);
  for(int i = 0; i < 20; i++) {
    set.add(i);
  }
  subsets = SetUtils.split(set, size);
  Assert.assertEquals(2, subsets.size());
  Assert.assertEquals(10, subsets.get(0).size());
  Assert.assertEquals(10, subsets.get(1).size());
  set = new LinkedHashSet<Integer>(27);
  for(int i = 0; i < 27; i++) {
    set.add(i);
  }
  subsets = SetUtils.split(set, size);
  Assert.assertEquals(3, subsets.size());
  Assert.assertEquals(10, subsets.get(0).size());
  Assert.assertEquals(10, subsets.get(1).size());
  Assert.assertEquals(7, subsets.get(2).size());
}