private void check( CollectionHolder holder, CollectionHolder original1, CollectionHolder original2) { Assert.isTrue(holder != original1); Assert.isTrue(holder != original2); if (holder.name().equals("h1")) checkH1(holder); else checkH2(holder); }
private void checkH2(CollectionHolder holder) { Assert.areEqual("h1", ((CollectionHolder) holder.map().get("key")).name()); Assert.areEqual("h1", ((CollectionHolder) holder.map().get(holder)).name()); Assert.areEqual("two", holder.list().get(0)); Assert.areEqual("h1", ((CollectionHolder) holder.list().get(1)).name()); Assert.areEqual(holder, holder.list().get(2)); Assert.isTrue(holder.set().remove("two")); Assert.isTrue(holder.set().remove(holder)); CollectionHolder remaining = nextCollectionHolder(holder.set().iterator()); Assert.areEqual("h1", remaining.name()); }