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

Comparing jsr166/src/test/tck/ConcurrentHashMap8Test.java (file contents):
Revision 1.23 by jsr166, Fri Feb 27 19:47:57 2015 UTC vs.
Revision 1.28 by jsr166, Sat Apr 25 04:55:30 2015 UTC

# Line 26 | Line 26 | import junit.framework.TestSuite;
26  
27   public class ConcurrentHashMap8Test extends JSR166TestCase {
28      public static void main(String[] args) {
29 <        junit.textui.TestRunner.run(suite());
29 >        main(suite(), args);
30      }
31      public static Test suite() {
32          return new TestSuite(ConcurrentHashMap8Test.class);
# Line 163 | Line 163 | public class ConcurrentHashMap8Test exte
163          Set<Integer> a = ConcurrentHashMap.<Integer>newKeySet();
164          assertTrue(a.isEmpty());
165          for (int i = 0; i < n; i++)
166 <            a.add(i);
166 >            assertTrue(a.add(i));
167          assertEquals(n == 0, a.isEmpty());
168          assertEquals(n, a.size());
169          return a;
# Line 173 | Line 173 | public class ConcurrentHashMap8Test exte
173          Set<Integer> a = ConcurrentHashMap.<Integer>newKeySet();
174          assertTrue(a.isEmpty());
175          for (int i = 0; i < elements.length; i++)
176 <            a.add(elements[i]);
176 >            assertTrue(a.add(elements[i]));
177          assertFalse(a.isEmpty());
178          assertEquals(elements.length, a.size());
179          return a;
# Line 251 | Line 251 | public class ConcurrentHashMap8Test exte
251       */
252      public void testAdd2() {
253          Set full = populatedSet(3);
254 <        full.add(one);
254 >        assertFalse(full.add(one));
255          assertEquals(3, full.size());
256      }
257  
# Line 260 | Line 260 | public class ConcurrentHashMap8Test exte
260       */
261      public void testAdd3() {
262          Set full = populatedSet(3);
263 <        full.add(three);
263 >        assertTrue(full.add(three));
264 >        assertTrue(full.contains(three));
265 >        assertFalse(full.add(three));
266          assertTrue(full.contains(three));
267      }
268  
# Line 273 | Line 275 | public class ConcurrentHashMap8Test exte
275          try {
276              full.add(three);
277              shouldThrow();
278 <        } catch (UnsupportedOperationException e){}
278 >        } catch (UnsupportedOperationException success) {}
279      }
280  
281      /**
# Line 285 | Line 287 | public class ConcurrentHashMap8Test exte
287          try {
288              full.add(null);
289              shouldThrow();
290 <        } catch (NullPointerException e){}
290 >        } catch (NullPointerException success) {}
291      }
292  
293      /**
# Line 297 | Line 299 | public class ConcurrentHashMap8Test exte
299          try {
300              map.keySet(null);
301              shouldThrow();
302 <        } catch (NullPointerException e) {}
302 >        } catch (NullPointerException success) {}
303          ConcurrentHashMap.KeySetView set = map.keySet(one);
304 <        set.add(one);
305 <        set.add(six);
306 <        set.add(seven);
304 >        assertFalse(set.add(one));
305 >        assertTrue(set.add(six));
306 >        assertTrue(set.add(seven));
307          assertTrue(set.getMappedValue() == one);
308          assertTrue(map.get(one) != one);
309          assertTrue(map.get(six) == one);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines