53 |
|
Object newHead; |
54 |
|
do { |
55 |
|
newHead = new Integer(rnd.nextInt()); |
56 |
< |
} while (m.containsKey(newHead)); |
56 |
> |
} while (m.containsKey(newHead) || newHead.equals(nil)); |
57 |
|
m.put(newHead, head); |
58 |
|
head = newHead; |
59 |
|
} |
99 |
|
} |
100 |
|
|
101 |
|
@Test(dataProvider = "Supplier<Map<Integer,Integer>>") |
102 |
< |
public static void testCheckeMap2(String description, Supplier<Map<Integer,Integer>> supplier) { |
102 |
> |
public static void testCheckedMap2(String description, Supplier<Map<Integer,Integer>> supplier) { |
103 |
|
Map m = supplier.get(); |
104 |
|
for (int i=0; i<mapSize; i++) |
105 |
|
if (m.put(new Integer(i), new Integer(2*i)) != null) |
106 |
< |
fail("put returns a non-null value erroenously."); |
106 |
> |
fail("put returns a non-null value erroneously."); |
107 |
|
for (int i=0; i<2*mapSize; i++) |
108 |
|
if (m.containsValue(new Integer(i)) != (i%2==0)) |
109 |
|
fail("contains value "+i); |
110 |
|
if (m.put(nil, nil) == null) |
111 |
< |
fail("put returns a null value erroenously."); |
111 |
> |
fail("put returns a null value erroneously."); |
112 |
|
Map m2 = supplier.get(); m2.putAll(m); |
113 |
|
if (!m.equals(m2)) |
114 |
|
fail("Clone not equal to original. (1)"); |