1 |
|
/* |
2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
< |
* http://creativecommons.org/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
|
import junit.framework.*; |
280 |
|
public void testRemoveElement() { |
281 |
|
TreeSet q = populatedSet(SIZE); |
282 |
|
for (int i = 1; i < SIZE; i+=2) { |
283 |
< |
assertTrue(q.remove(new Integer(i))); |
283 |
> |
assertTrue(q.contains(i)); |
284 |
> |
assertTrue(q.remove(i)); |
285 |
> |
assertFalse(q.contains(i)); |
286 |
> |
assertTrue(q.contains(i-1)); |
287 |
|
} |
288 |
|
for (int i = 0; i < SIZE; i+=2) { |
289 |
< |
assertTrue(q.remove(new Integer(i))); |
290 |
< |
assertFalse(q.remove(new Integer(i+1))); |
289 |
> |
assertTrue(q.contains(i)); |
290 |
> |
assertTrue(q.remove(i)); |
291 |
> |
assertFalse(q.contains(i)); |
292 |
> |
assertFalse(q.remove(i+1)); |
293 |
> |
assertFalse(q.contains(i+1)); |
294 |
|
} |
295 |
|
assertTrue(q.isEmpty()); |
296 |
|
} |