Code example for TreeSet

Methods: clear, contains, size

0
	/** 
	 * @tests java.util.TreeSet#clear() 
	 */ 
	public void test_clear() { 
		// Test for method void java.util.TreeSet.clear() 
		ts.clear();
		assertEquals("Returned non-zero size after clear", 0, ts.size());
		assertTrue("Found element in cleared set", !ts.contains(objArray[0]));
	} 
 
	/** 
	 * @tests java.util.TreeSet#clone() 
	 */ 
	public void test_clone() { 
		// Test for method java.lang.Object java.util.TreeSet.clone() 
		TreeSet s = (TreeSet) ts.clone();
		Iterator i = ts.iterator();
		while (i.hasNext())
			assertTrue("Clone failed to copy all elements", s
					.contains(i.next()));
	}