public void testIllegalAdd() { Set set = makeTestSet(); Integer i = new Integer(3); try { set.add(i); fail("Integer should fail string predicate."); } catch (IllegalArgumentException e) { // expected } assertTrue("Collection shouldn't contain illegal element", !set.contains(i)); }
protected Set makeTestSet() { return decorateSet(new HashSet(), testPredicate); }
public void testGetSet() { Set set = makeTestSet(); assertTrue("returned set should not be null", ((PredicatedSet) set).getSet() != null); }
public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(TestCompositeSet.suite()); suite.addTest(TestListOrderedSet.suite()); suite.addTest(TestListOrderedSet2.suite()); suite.addTest(TestMapBackedSet.suite()); suite.addTest(TestMapBackedSet2.suite()); suite.addTest(TestPredicatedSet.suite()); suite.addTest(TestPredicatedSortedSet.suite()); suite.addTest(TestSynchronizedSet.suite()); suite.addTest(TestSynchronizedSortedSet.suite()); suite.addTest(TestTransformedSet.suite()); suite.addTest(TestTransformedSortedSet.suite()); suite.addTest(TestTypedSet.suite()); suite.addTest(TestTypedSortedSet.suite()); suite.addTest(TestUnmodifiableSet.suite()); suite.addTest(TestUnmodifiableSortedSet.suite()); return suite; }
public void testIllegalAddAll() { Set set = makeTestSet(); Set elements = new HashSet(); elements.add("one"); elements.add("two"); elements.add(new Integer(3)); elements.add("four"); try { set.addAll(elements); fail("Integer should fail string predicate."); } catch (IllegalArgumentException e) { // expected } assertTrue("Set shouldn't contain illegal element", !set.contains("one")); assertTrue("Set shouldn't contain illegal element", !set.contains("two")); assertTrue("Set shouldn't contain illegal element", !set.contains(new Integer(3))); assertTrue("Set shouldn't contain illegal element", !set.contains("four")); }
public Set makeEmptySet() { return decorateSet(new HashSet(), truePredicate); }