--- jsr166/src/test/tck/ConcurrentHashMapTest.java 2012/02/21 02:04:17 1.28 +++ jsr166/src/test/tck/ConcurrentHashMapTest.java 2012/09/11 23:12:20 1.29 @@ -569,16 +569,15 @@ public class ConcurrentHashMapTest exten map.put(new Integer(i), new Integer(i)); assertFalse(map.isEmpty()); Map.Entry entry1 = (Map.Entry)map.entrySet().iterator().next(); - - // assert that entry1 is not 16 - assertTrue("entry is 16, test not valid", - !entry1.getKey().equals(new Integer(16))); - - // remove 16 (a different key) from map - // which just happens to cause entry1 to be cloned in map - map.remove(new Integer(16)); - entry1.setValue("XYZ"); - assertTrue(map.containsValue("XYZ")); // fails + // Unless it happens to be first (in which case remainder of + // test is skipped), remove a possibly-colliding key from map + // which, under some implementations, may cause entry1 to be + // cloned in map + if (!entry1.getKey().equals(new Integer(16))) { + map.remove(new Integer(16)); + entry1.setValue("XYZ"); + assertTrue(map.containsValue("XYZ")); // fails if write-through broken + } } }