### Question:
UnionFind { public int union(int i, int j) { int firstRoot = find(i); int secondRoot = find(j); if (firstRoot == secondRoot) { return firstRoot; } if (ranks[firstRoot] < ranks[secondRoot]) { roots[firstRoot] = secondRoot; sizes[secondRoot] += sizes[firstRoot]; } else if (ranks[firstRoot] > ranks[secondRoot]) { roots[secondRoot] = firstRoot; sizes[firstRoot] += sizes[secondRoot]; } else { roots[firstRoot] = secondRoot; sizes[secondRoot] += sizes[firstRoot]; ranks[secondRoot]++; } subsetsCount--; return roots[firstRoot]; } UnionFind(int n); int find(int i); int union(int i, int j); int getSubsetSize(int i); int getSubsetsCount();  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testUnionIllegalArgument1() { UnionFind unionFind = new UnionFind(5); unionFind.union(0, -1); }
@Test(expected = IllegalArgumentException.class) public void testUnionIllegalArgument2() { UnionFind unionFind = new UnionFind(5); unionFind.union(1, 5); }