1 9 package test.ozoneDB.DxLib; 10 11 import org.ozoneDB.DxLib.*; 12 13 19 public class MapTest extends AbstractTest { 20 21 22 public MapTest() { 23 super("testContainsKey"); 24 } 25 26 public MapTest(String name) { 27 super(name); 28 } 29 30 public void testContainsKey() throws Exception { 31 Class [] factories = {DxHashMap.class, DxTreeMap.class, DxMultiMap.class}; 32 33 for (int i = 0; i < factories.length; i++) { 35 containsKey((DxMap) factories[i].newInstance(), CollectionTest.newDxStrings()); 36 } 37 String mapDir = System.getProperty("java.io.tmpdir")+ "/test/page/"; 38 DxDiskHashMap map = new DxDiskHashMap(mapDir, 30, 10, 8); 39 containsKey(map, CollectionTest.newIntegers()); 40 map.printStatistics(); 41 } 42 44 public void containsKey(DxMap map, Object [] objs) throws Exception { 45 startTimer(map.getClass().getName(), "containsKey"); 46 map.addAll(objs); 47 stopTimer(); 48 50 for (int i = 0; i < objs.length; i++) { 51 if (!map.containsKey(objs[i])) { 52 error(); 53 } 54 if (!map.containsKey(objs[i])) { 55 error(); 56 } 57 } 58 if (map.containsKey(new DxString("hallo"))) { 59 error(); 60 } 61 stopTimer(); 62 } 63 64 } 65 | Popular Tags |