Code example for LinkedHashSet

Methods: add, contains, size

0
	/** 
	 * @tests java.util.LinkedHashSet#add(java.lang.Object) 
	 */ 
	public void test_addLjava_lang_Object() { 
		// Test for method boolean java.util.LinkedHashSet.add(java.lang.Object) 
		int size = hs.size();
		hs.add(new Integer(8));
		assertTrue("Added element already contained by set", hs.size() == size);
		hs.add(new Integer(-9));
		assertTrue("Failed to increment set size after add",
				hs.size() == size + 1);
		assertTrue("Failed to add element to set", hs.contains(new Integer(-9)));
	} 
 
	/** 
	 * @tests java.util.LinkedHashSet#clear() 
	 */ 
	public void test_clear() { 
		// Test for method void java.util.LinkedHashSet.clear() 
		Set orgSet = (Set) hs.clone();
		hs.clear();