1 16 package org.apache.commons.collections; 17 18 import java.util.TreeMap ; 19 20 import org.apache.commons.collections.map.AbstractTestMap; 21 22 29 public abstract class TestTreeMap extends AbstractTestMap { 30 31 public TestTreeMap(String testName) { 32 super(testName); 33 } 34 35 public static void main(String args[]) { 36 String [] testCaseName = { TestTreeMap.class.getName()}; 37 junit.textui.TestRunner.main(testCaseName); 38 } 39 40 public boolean isAllowNullKey() { 41 return false; 42 } 43 44 protected TreeMap map = null; 45 46 public void setUp() { 47 map = (TreeMap ) makeEmptyMap(); 48 } 49 50 public void testNewMap() { 51 assertTrue("New map is empty", map.isEmpty()); 52 assertEquals("New map has size zero", map.size(), 0); 53 } 54 55 public void testSearch() { 56 map.put("first", "First Item"); 57 map.put("second", "Second Item"); 58 assertEquals("Top item is 'Second Item'", map.get("first"), "First Item"); 59 assertEquals("Next Item is 'First Item'", map.get("second"), "Second Item"); 60 } 61 } 62 | Popular Tags |