1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
package com.netscape.cmscore.request;
import java.util.Hashtable;
import junit.framework.Test;
import junit.framework.TestSuite;
import com.netscape.cmscore.test.CMSBaseTestCase;
public class ExtDataHashtableTest extends CMSBaseTestCase {
ExtDataHashtable<String> hash;
public ExtDataHashtableTest(String name) {
super(name);
}
public void cmsTestSetUp() {
hash = new ExtDataHashtable<String>();
}
public void cmsTestTearDown() {
}
public static Test suite() {
return new TestSuite(ExtDataHashtableTest.class);
}
public void testContainsKey() {
hash.put("FOO", "bar");
assertTrue(hash.containsKey("foo"));
assertTrue(hash.containsKey("Foo"));
}
public void testGet() {
hash.put("FOO", "bar");
assertEquals("bar", hash.get("foo"));
assertEquals("bar", hash.get("fOO"));
}
public void testPut() {
hash.put("FOO", "bar");
hash.put("foo", "bar2");
assertEquals(1, hash.keySet().size());
assertEquals("bar2", hash.get("foo"));
}
public void testPutAll() {
Hashtable<String, String> hash2 = new Hashtable<String, String>();
hash2.put("KEY1", "VAL1");
hash2.put("KEY2", "val2");
hash.putAll(hash2);
assertTrue(hash.containsKey("key1"));
assertEquals("VAL1", hash.get("key1"));
assertEquals("val2", hash.get("Key2"));
}
public void testRemove() {
hash.put("foo", "bar");
hash.put("one", "two");
hash.remove("FOO");
assertFalse(hash.containsKey("foo"));
assertTrue(hash.containsKey("one"));
}
public void testMapConstructor() {
Hashtable<String, String> hash2 = new Hashtable<String, String>();
hash2.put("KEY1", "VAL1");
hash2.put("KEY2", "val2");
hash = new ExtDataHashtable<String>(hash2);
assertTrue(hash.containsKey("key1"));
assertEquals("VAL1", hash.get("key1"));
assertEquals("val2", hash.get("Key2"));
}
}
|