Code example for TreeSet

Methods: isEmpty

0
	/** 
	 * @tests java.util.TreeSet#TreeSet() 
	 */ 
	public void test_Constructor() { 
		// Test for method java.util.TreeSet() 
		assertTrue("Did not construct correct TreeSet", new TreeSet().isEmpty());
	} 
 
	/** 
	 * @tests java.util.TreeSet#TreeSet(java.util.Collection) 
	 */ 
	public void test_ConstructorLjava_util_Collection() { 
		// Test for method java.util.TreeSet(java.util.Collection) 
		TreeSet myTreeSet = new TreeSet(Arrays.asList(objArray));
		assertTrue("TreeSet incorrect size",
				myTreeSet.size() == objArray.length);
		for (int counter = 0; counter < objArray.length; counter++)
			assertTrue("TreeSet does not contain correct elements", myTreeSet
					.contains(objArray[counter]));
	}