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.*; |
239 |
|
public void testRemoveElement() { |
240 |
|
NavigableSet q = populatedSet(SIZE); |
241 |
|
for (int i = 1; i < SIZE; i+=2) { |
242 |
< |
assertTrue(q.remove(new Integer(i))); |
242 |
> |
assertTrue(q.contains(i)); |
243 |
> |
assertTrue(q.remove(i)); |
244 |
> |
assertFalse(q.contains(i)); |
245 |
> |
assertTrue(q.contains(i-1)); |
246 |
|
} |
247 |
|
for (int i = 0; i < SIZE; i+=2) { |
248 |
< |
assertTrue(q.remove(new Integer(i))); |
249 |
< |
assertFalse(q.remove(new Integer(i+1))); |
248 |
> |
assertTrue(q.contains(i)); |
249 |
> |
assertTrue(q.remove(i)); |
250 |
> |
assertFalse(q.contains(i)); |
251 |
> |
assertFalse(q.remove(i+1)); |
252 |
> |
assertFalse(q.contains(i+1)); |
253 |
|
} |
254 |
|
assertTrue(q.isEmpty()); |
255 |
|
} |