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.48 by jsr166, Sun Jul 17 03:40:07 2016 UTC vs.
Revision 1.51 by jsr166, Sat Oct 15 18:51:12 2016 UTC

# Line 16 | Line 16 | import java.util.Map;
16   import java.util.Random;
17   import java.util.Set;
18   import java.util.concurrent.ConcurrentHashMap;
19 + import java.util.concurrent.ExecutorService;
20 + import java.util.concurrent.Executors;
21  
22   import junit.framework.Test;
23   import junit.framework.TestSuite;
# Line 331 | Line 333 | public class ConcurrentHashMapTest exten
333      }
334  
335      /**
336 +     * Test keySet().removeAll on empty map
337 +     */
338 +    public void testKeySet_empty_removeAll() {
339 +        ConcurrentHashMap<Integer, String> map = new ConcurrentHashMap<>();
340 +        Set<Integer> set = map.keySet();
341 +        set.removeAll(Collections.emptyList());
342 +        assertTrue(map.isEmpty());
343 +        assertTrue(set.isEmpty());
344 +        // following is test for JDK-8163353
345 +        set.removeAll(Collections.emptySet());
346 +        assertTrue(map.isEmpty());
347 +        assertTrue(set.isEmpty());
348 +    }
349 +
350 +    /**
351       * keySet.toArray returns contains all keys
352       */
353      public void testKeySetToArray() {
# Line 808 | Line 825 | public class ConcurrentHashMapTest exten
825       * ant -Djsr166.tckTestClass=ConcurrentHashMapTest -Djsr166.methodFilter=testRemoveAll_performance -Djsr166.expensiveTests=true tck
826       */
827      public void testRemoveAll_performance() {
828 <        int mapSize = expensiveTests ? 1_000_000 : 100;
829 <        int iterations = expensiveTests ? 500 : 2;
830 <        ConcurrentHashMap<Integer, Integer> map = new ConcurrentHashMap<>();
828 >        final int mapSize = expensiveTests ? 1_000_000 : 100;
829 >        final int iterations = expensiveTests ? 500 : 2;
830 >        final ConcurrentHashMap<Integer, Integer> map = new ConcurrentHashMap<>();
831          for (int i = 0; i < mapSize; i++)
832              map.put(i, i);
833          Set<Integer> keySet = map.keySet();
# Line 819 | Line 836 | public class ConcurrentHashMapTest exten
836              assertFalse(keySet.removeAll(removeMe));
837          assertEquals(mapSize, map.size());
838      }
839 +
840   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines