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.18 by jsr166, Wed Dec 31 19:05:42 2014 UTC vs.
Revision 1.22 by jsr166, Sat Jan 17 22:55:06 2015 UTC

# Line 180 | Line 180 | public class ConcurrentHashMap8Test exte
180          return a;
181      }
182  
183 <    /*
183 >    /**
184       * replaceAll replaces all matching values.
185       */
186      public void testReplaceAll() {
187          ConcurrentHashMap<Integer, String> map = map5();
188 <        map.replaceAll((x, y) -> {return x > 3 ? "Z" : y;});
188 >        map.replaceAll((x, y) -> { return x > 3 ? "Z" : y; });
189          assertEquals("A", map.get(one));
190          assertEquals("B", map.get(two));
191          assertEquals("C", map.get(three));
# Line 223 | Line 223 | public class ConcurrentHashMap8Test exte
223          assertFalse(set2.contains(six));
224      }
225  
226
226      /**
227       * keySet.addAll adds each element from the given collection
228       */
# Line 420 | Line 419 | public class ConcurrentHashMap8Test exte
419              assertTrue(it.hasNext());
420              it.next();
421          }
422 <        assertFalse(it.hasNext());
423 <        try {
424 <            it.next();
425 <            shouldThrow();
426 <        } catch (NoSuchElementException success) {}
422 >        assertIteratorExhausted(it);
423 >    }
424 >
425 >    /**
426 >     * iterator of empty collections has no elements
427 >     */
428 >    public void testEmptyIterator() {
429 >        assertIteratorExhausted(ConcurrentHashMap.newKeySet().iterator());
430 >        assertIteratorExhausted(new ConcurrentHashMap().entrySet().iterator());
431 >        assertIteratorExhausted(new ConcurrentHashMap().values().iterator());
432 >        assertIteratorExhausted(new ConcurrentHashMap().keySet().iterator());
433      }
434  
435      /**
# Line 1003 | Line 1008 | public class ConcurrentHashMap8Test exte
1008      public void testSearchValuesSequentially() {
1009          ConcurrentHashMap<Long, Long> m = longMap();
1010          Long r;
1011 <        r = m.searchValues(Long.MAX_VALUE, (Long x) -> x.longValue() == (long)(SIZE/2)? x : null);
1011 >        r = m.searchValues(Long.MAX_VALUE,
1012 >            (Long x) -> (x.longValue() == (long)(SIZE/2)) ? x : null);
1013          assertEquals((long)r, (long)(SIZE/2));
1014 <        r = m.searchValues(Long.MAX_VALUE, (Long x) -> x.longValue() < 0L ? x : null);
1014 >        r = m.searchValues(Long.MAX_VALUE,
1015 >            (Long x) -> (x.longValue() < 0L) ? x : null);
1016          assertNull(r);
1017      }
1018  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines