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.32 by jsr166, Sat Oct 15 18:51:12 2016 UTC vs.
Revision 1.36 by jsr166, Sun Jan 7 23:31:01 2018 UTC

# Line 63 | Line 63 | public class ConcurrentHashMap8Test exte
63       */
64      public void testComputeIfAbsent() {
65          ConcurrentHashMap map = map5();
66 <        map.computeIfAbsent(six, (x) -> "Z");
66 >        map.computeIfAbsent(six, x -> "Z");
67          assertTrue(map.containsKey(six));
68      }
69  
# Line 72 | Line 72 | public class ConcurrentHashMap8Test exte
72       */
73      public void testComputeIfAbsent2() {
74          ConcurrentHashMap map = map5();
75 <        assertEquals("A", map.computeIfAbsent(one, (x) -> "Z"));
75 >        assertEquals("A", map.computeIfAbsent(one, x -> "Z"));
76      }
77  
78      /**
# Line 80 | Line 80 | public class ConcurrentHashMap8Test exte
80       */
81      public void testComputeIfAbsent3() {
82          ConcurrentHashMap map = map5();
83 <        map.computeIfAbsent(six, (x) -> null);
83 >        map.computeIfAbsent(six, x -> null);
84          assertFalse(map.containsKey(six));
85      }
86  
# Line 185 | Line 185 | public class ConcurrentHashMap8Test exte
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) -> (x > 3) ? "Z" : y);
189          assertEquals("A", map.get(one));
190          assertEquals("B", map.get(two));
191          assertEquals("C", map.get(three));
# Line 210 | Line 210 | public class ConcurrentHashMap8Test exte
210          Set set1 = map.keySet();
211          Set set2 = map.keySet(true);
212          set2.add(six);
213 <        assertTrue(((ConcurrentHashMap.KeySetView)set2).getMap() == map);
214 <        assertTrue(((ConcurrentHashMap.KeySetView)set1).getMap() == map);
213 >        assertSame(map, ((ConcurrentHashMap.KeySetView)set2).getMap());
214 >        assertSame(map, ((ConcurrentHashMap.KeySetView)set1).getMap());
215          assertEquals(set2.size(), map.size());
216          assertEquals(set1.size(), map.size());
217          assertTrue((Boolean)map.get(six));
# Line 305 | Line 305 | public class ConcurrentHashMap8Test exte
305          assertFalse(set.add(one));
306          assertTrue(set.add(six));
307          assertTrue(set.add(seven));
308 <        assertTrue(set.getMappedValue() == one);
309 <        assertTrue(map.get(one) != one);
310 <        assertTrue(map.get(six) == one);
311 <        assertTrue(map.get(seven) == one);
308 >        assertSame(one, set.getMappedValue());
309 >        assertNotSame(one, map.get(one));
310 >        assertSame(one, map.get(six));
311 >        assertSame(one, map.get(seven));
312      }
313  
314      void checkSpliteratorCharacteristics(Spliterator<?> sp,
# Line 543 | Line 543 | public class ConcurrentHashMap8Test exte
543      }
544  
545      /**
546 <     * A deserialized serialized set is equal
546 >     * A deserialized/reserialized set equals original
547       */
548      public void testSerialization() throws Exception {
549          int size = 20;
# Line 1107 | Line 1107 | public class ConcurrentHashMap8Test exte
1107                  public void realRun() {
1108                      int result = 0;
1109                      for (int i = 0; i < iterations; i++)
1110 <                        result += map.computeIfAbsent(i % mapSize, (k) -> k + k);
1110 >                        result += map.computeIfAbsent(i % mapSize, k -> k + k);
1111                      if (result == -42) throw new Error();
1112                  }};
1113              for (int i = 0; i < threads; i++)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines