ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ConcurrentHashMapTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ConcurrentHashMapTest.java (file contents):
Revision 1.2 by dl, Sun Sep 7 20:39:11 2003 UTC vs.
Revision 1.4 by dl, Sat Sep 20 00:31:57 2003 UTC

# Line 11 | Line 11 | import java.util.concurrent.*;
11   import java.util.Enumeration;
12   import java.io.*;
13  
14 < public class ConcurrentHashMapTest extends TestCase{
14 > public class ConcurrentHashMapTest extends JSR166TestCase{
15      public static void main(String[] args) {
16          junit.textui.TestRunner.run (suite());  
17      }
# Line 19 | Line 19 | public class ConcurrentHashMapTest exten
19          return new TestSuite(ConcurrentHashMapTest.class);
20      }
21  
22    static final Integer one = new Integer(1);
23    static final Integer two = new Integer(2);
24    static final Integer three = new Integer(3);
25    static final Integer four = new Integer(4);
26    static final Integer five = new Integer(5);
27
22      private static ConcurrentHashMap map5() {  
23          ConcurrentHashMap map = new ConcurrentHashMap(5);
24          assertTrue(map.isEmpty());
# Line 39 | Line 33 | public class ConcurrentHashMapTest exten
33      }
34  
35      /**
36 <     *  Test to verify clear correctly removes all key-element pairs from the map
36 >     *   clear  removes all key-element pairs from the map
37       */
38      public void testClear(){
39          ConcurrentHashMap map = map5();
# Line 48 | Line 42 | public class ConcurrentHashMapTest exten
42      }
43  
44      /**
45 <     *  Test to verify contains gives the appropriate value
45 >     *   contains gives the appropriate value
46       */
47      public void testContains(){
48          ConcurrentHashMap map = map5();
# Line 57 | Line 51 | public class ConcurrentHashMapTest exten
51      }
52      
53      /**
54 <     *  Test to verify containsKey gives the appropriate value
54 >     *   containsKey gives the appropriate value
55       */
56      public void testContainsKey(){
57          ConcurrentHashMap map = map5();
# Line 75 | Line 69 | public class ConcurrentHashMapTest exten
69      }
70  
71      /**
72 <     *  tes to verify enumeration returns an enumeration containing the correct elements
72 >     *   enumeration returns an enumeration containing the correct
73 >     *   elements
74       */
75      public void testEnumeration(){
76          ConcurrentHashMap map = map5();
# Line 89 | Line 84 | public class ConcurrentHashMapTest exten
84      }
85  
86      /**
87 <     *  Test to verify get returns the correct element at the given index
87 >     *   Clone creates an equal map
88 >     */
89 >    public void testClone(){
90 >        ConcurrentHashMap map = map5();
91 >        ConcurrentHashMap m2 = (ConcurrentHashMap)(map.clone());
92 >        assertEquals(map, m2);
93 >    }
94 >
95 >    /**
96 >     *   get returns the correct element at the given index
97       */
98      public void testGet(){
99          ConcurrentHashMap map = map5();
# Line 97 | Line 101 | public class ConcurrentHashMapTest exten
101      }
102  
103      /**
104 <     *  Test to verify get on a nonexistant key returns null
104 >     *   get on a nonexistant key returns null
105       */
106      public void testGet2(){
107          ConcurrentHashMap empty = new ConcurrentHashMap();
# Line 115 | Line 119 | public class ConcurrentHashMapTest exten
119      }
120  
121      /**
122 <     *  Test to verify keys returns an enumeration containing all the keys from the map
122 >     *   keys returns an enumeration containing all the keys from the map
123       */
124      public void testKeys(){
125          ConcurrentHashMap map = map5();
# Line 129 | Line 133 | public class ConcurrentHashMapTest exten
133      }
134  
135      /**
136 <     *  Test to verify keySet returns a Set containing all the keys
136 >     *   keySet returns a Set containing all the keys
137       */
138      public void testKeySet(){
139          ConcurrentHashMap map = map5();
# Line 170 | Line 174 | public class ConcurrentHashMapTest exten
174      }
175  
176      /**
177 <     *  Test to verify putAll correctly adds all key-value pairs from the given map
177 >     *   putAll  adds all key-value pairs from the given map
178       */
179      public void testPutAll(){
180          ConcurrentHashMap empty = new ConcurrentHashMap();
# Line 185 | Line 189 | public class ConcurrentHashMapTest exten
189      }
190  
191      /**
192 <     *  Test to verify putIfAbsent works when the given key is not present
192 >     *   putIfAbsent works when the given key is not present
193       */
194      public void testPutIfAbsent(){
195          ConcurrentHashMap map = map5();
# Line 194 | Line 198 | public class ConcurrentHashMapTest exten
198      }
199  
200      /**
201 <     *  Test to verify putIfAbsent does not add the pair if the key is already present
201 >     *   putIfAbsent does not add the pair if the key is already present
202       */
203      public void testPutIfAbsent2(){
204          ConcurrentHashMap map = map5();
# Line 202 | Line 206 | public class ConcurrentHashMapTest exten
206      }
207  
208      /**
209 <     *  Test to verify remove removes the correct key-value pair from the map
209 >     *   remove removes the correct key-value pair from the map
210       */
211      public void testRemove(){
212          ConcurrentHashMap map = map5();
# Line 223 | Line 227 | public class ConcurrentHashMapTest exten
227      }
228  
229      /**
230 <     *  Simple test to verify size returns the correct values
230 >     *   size returns the correct values
231       */
232      public void testSize(){
233          ConcurrentHashMap map = map5();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines