public void testRemoveUnderlying() { Set one = buildOne(); Set two = buildTwo(); CompositeSet set = new CompositeSet(new Set[]{one, two}); one.remove("1"); assertFalse(set.contains("1")); two.remove("3"); assertFalse(set.contains("3")); }
public void testRemoveComposited() { Set one = buildOne(); Set two = buildTwo(); CompositeSet set = new CompositeSet(new Set[]{one, two}); set.remove("1"); assertFalse(one.contains("1")); set.remove("3"); assertFalse(one.contains("3")); }
public void testContains() { CompositeSet set = new CompositeSet(new Set[]{buildOne(), buildTwo()}); assertTrue(set.contains("1")); }
public void testFailedCollisionResolution() { Set one = buildOne(); Set two = buildTwo(); CompositeSet set = new CompositeSet(new Set[]{one, two}); set.setMutator(new CompositeSet.SetMutator() {
public void testAddComposited() { Set one = buildOne(); Set two = buildTwo(); CompositeSet set = new CompositeSet(); set.addComposited(one, two); CompositeSet set2 = new CompositeSet(buildOne()); set2.addComposited(buildTwo()); assertTrue(set.equals(set2)); HashSet set3 = new HashSet(); set3.add("1"); set3.add("2"); set3.add("3"); HashSet set4 = new HashSet(); set4.add("4"); CompositeSet set5 = new CompositeSet(set3); set5.addComposited(set4); assertTrue(set.equals(set5)); try { set.addComposited(set3); fail("Expecting UnsupportedOperationException."); } catch (UnsupportedOperationException ex) { // expected } } }