@Test
public void testSetOf() {

    LOG.info("testSetOf");
    final Collection<Integer> x = Immutables.setOf(1);
    Assert.assertTrue("Set " + x + " should contain 1", x.contains(1));
    final Collection<Integer> a = Immutables.setOf(1, 2);
    Assert.assertTrue("Set " + a + " should contain 1", a.contains(1));
    Assert.assertTrue("Set " + a + " should contain 2", a.contains(2));
    @SuppressWarnings("unchecked")
    final Collection<Integer> b = Immutables.setOf();
    Assert.assertTrue("Set " + b + " should be empty", b.isEmpty());
    final Collection<Integer> c = Immutables.setOf(a, 3, 4);
    final Collection<Integer> d = Immutables.setOf(4, 2, 1, 3);
    Assert.assertTrue("Set " + c + " should equal " + d, d.equals(c));
    final Collection<Integer> u0 = Immutables.setOf(Immutables.<Integer>emptyList());
    @SuppressWarnings("unchecked")
    final Collection<Integer> v0 = Immutables.setOf();
    Assert.assertTrue("Set " + u0 + " should equal " + v0, u0.equals(v0));
    final ArrayList<Integer> z1 = new ArrayList<>();
    final ArrayList<Integer> z2 = new ArrayList<>();
    z2.add(1);
    final LinkedHashSet<Integer> zz1 = new LinkedHashSet<>();
    final LinkedHashSet<Integer> zz2 = new LinkedHashSet<>();
    zz2.add(1);
    final Collection<Integer> u1 = Immutables.setOf(Immutables.<Integer>emptyList(), 1);
    final Collection<Integer> v1 = Immutables.setOf(Immutables.setOf(1));
    final Collection<Integer> uu1 = Immutables.setOf(z1);
    final Collection<Integer> uuu1 = Immutables.setOf(z2);
    final Collection<Integer> vv1 = Immutables.setOf(zz1);
    final Collection<Integer> vvv1 = Immutables.setOf(zz2);
    final Collection<Integer> w1 = Immutables.setOf(1);
    Assert.assertTrue("Set " + u1 + " should equal " + w1, u1.equals(w1));
    Assert.assertTrue("Set " + v1 + " should equal " + w1, v1.equals(w1));
    Assert.assertTrue("Array " + uu1 + " should be empty", uu1.isEmpty());
    Assert.assertTrue("Array " + uuu1 + " should equal w1" + w1, uuu1.equals(w1));
    Assert.assertTrue("Array " + vv1 + " should be empty", vv1.isEmpty());
    Assert.assertTrue("Array " + vvv1 + " should equal w1" + w1, vvv1.equals(w1));
    final Collection<Integer> u2 = Immutables.setOf(Immutables.<Integer>emptyList(), 1, 2);
    final Collection<Integer> v2 = Immutables.setOf(1, 2);
    Assert.assertTrue("Set " + u2 + " should equal " + v2, u2.equals(v2));
}