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.28 by jsr166, Tue Feb 21 02:04:17 2012 UTC vs.
Revision 1.29 by dl, Tue Sep 11 23:12:20 2012 UTC

# Line 569 | Line 569 | public class ConcurrentHashMapTest exten
569              map.put(new Integer(i), new Integer(i));
570          assertFalse(map.isEmpty());
571          Map.Entry entry1 = (Map.Entry)map.entrySet().iterator().next();
572 <
573 <        // assert that entry1 is not 16
574 <        assertTrue("entry is 16, test not valid",
575 <                   !entry1.getKey().equals(new Integer(16)));
576 <
577 <        // remove 16 (a different key) from map
578 <        // which just happens to cause entry1 to be cloned in map
579 <        map.remove(new Integer(16));
580 <        entry1.setValue("XYZ");
581 <        assertTrue(map.containsValue("XYZ")); // fails
572 >        // Unless it happens to be first (in which case remainder of
573 >        // test is skipped), remove a possibly-colliding key from map
574 >        // which, under some implementations, may cause entry1 to be
575 >        // cloned in map
576 >        if (!entry1.getKey().equals(new Integer(16))) {
577 >            map.remove(new Integer(16));
578 >            entry1.setValue("XYZ");
579 >            assertTrue(map.containsValue("XYZ")); // fails if write-through broken
580 >        }
581      }
582  
583   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines