--- jsr166/src/test/tck/ConcurrentHashMap8Test.java 2013/07/22 15:55:43 1.13 +++ jsr166/src/test/tck/ConcurrentHashMap8Test.java 2013/08/08 19:39:48 1.16 @@ -6,6 +6,7 @@ import junit.framework.*; import java.util.*; +import static java.util.Spliterator.*; import java.util.function.*; import java.util.concurrent.atomic.LongAdder; import java.util.concurrent.ConcurrentHashMap; @@ -54,7 +55,7 @@ public class ConcurrentHashMap8Test exte } /** - * computeIfAbsent does not replace if the key is already present + * computeIfAbsent does not replace if the key is already present */ public void testComputeIfAbsent2() { ConcurrentHashMap map = map5(); @@ -71,7 +72,7 @@ public class ConcurrentHashMap8Test exte } /** - * computeIfPresent does not replace if the key is already present + * computeIfPresent does not replace if the key is already present */ public void testComputeIfPresent() { ConcurrentHashMap map = map5(); @@ -88,7 +89,7 @@ public class ConcurrentHashMap8Test exte } /** - * compute does not replace if the function returns null + * compute does not replace if the function returns null */ public void testCompute() { ConcurrentHashMap map = map5(); @@ -299,6 +300,12 @@ public class ConcurrentHashMap8Test exte assertTrue(map.get(seven) == one); } + void checkSpliteratorCharacteristics(Spliterator sp, + int requiredCharacteristics) { + assertEquals(requiredCharacteristics, + requiredCharacteristics & sp.characteristics()); + } + /** * KeySetView.spliterator returns spliterator over the elements in this set */ @@ -307,6 +314,7 @@ public class ConcurrentHashMap8Test exte ConcurrentHashMap map = map5(); Set set = map.keySet(); Spliterator sp = set.spliterator(); + checkSpliteratorCharacteristics(sp, CONCURRENT | DISTINCT | NONNULL); assertEquals(sp.estimateSize(), map.size()); Spliterator sp2 = sp.trySplit(); sp.forEachRemaining((Integer x) -> adder.add(x.longValue()));