251 |
|
*/ |
252 |
|
public void testAdd2() { |
253 |
|
Set full = populatedSet(3); |
254 |
< |
full.add(one); |
254 |
> |
assertFalse(full.add(one)); |
255 |
|
assertEquals(3, full.size()); |
256 |
|
} |
257 |
|
|
260 |
|
*/ |
261 |
|
public void testAdd3() { |
262 |
|
Set full = populatedSet(3); |
263 |
< |
full.add(three); |
263 |
> |
assertTrue(full.add(three)); |
264 |
> |
assertTrue(full.contains(three)); |
265 |
> |
assertFalse(full.add(three)); |
266 |
|
assertTrue(full.contains(three)); |
267 |
|
} |
268 |
|
|
275 |
|
try { |
276 |
|
full.add(three); |
277 |
|
shouldThrow(); |
278 |
< |
} catch (UnsupportedOperationException e){} |
278 |
> |
} catch (UnsupportedOperationException success) {} |
279 |
|
} |
280 |
|
|
281 |
|
/** |
287 |
|
try { |
288 |
|
full.add(null); |
289 |
|
shouldThrow(); |
290 |
< |
} catch (NullPointerException e){} |
290 |
> |
} catch (NullPointerException success) {} |
291 |
|
} |
292 |
|
|
293 |
|
/** |
299 |
|
try { |
300 |
|
map.keySet(null); |
301 |
|
shouldThrow(); |
302 |
< |
} catch (NullPointerException e) {} |
302 |
> |
} catch (NullPointerException success) {} |
303 |
|
ConcurrentHashMap.KeySetView set = map.keySet(one); |
304 |
|
set.add(one); |
305 |
|
set.add(six); |