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.*; |
235 |
|
public void testRemoveElement() { |
236 |
|
NavigableSet q = populatedSet(SIZE); |
237 |
|
for (int i = 1; i < SIZE; i+=2) { |
238 |
< |
assertTrue(q.remove(new Integer(i))); |
238 |
> |
assertTrue(q.contains(i)); |
239 |
> |
assertTrue(q.remove(i)); |
240 |
> |
assertFalse(q.contains(i)); |
241 |
> |
assertTrue(q.contains(i-1)); |
242 |
|
} |
243 |
|
for (int i = 0; i < SIZE; i+=2) { |
244 |
< |
assertTrue(q.remove(new Integer(i))); |
245 |
< |
assertFalse(q.remove(new Integer(i+1))); |
244 |
> |
assertTrue(q.contains(i)); |
245 |
> |
assertTrue(q.remove(i)); |
246 |
> |
assertFalse(q.contains(i)); |
247 |
> |
assertFalse(q.remove(i+1)); |
248 |
> |
assertFalse(q.contains(i+1)); |
249 |
|
} |
250 |
|
assertTrue(q.isEmpty()); |
251 |
|
} |
476 |
|
NavigableSet q = populatedSet(SIZE); |
477 |
|
String s = q.toString(); |
478 |
|
for (int i = 0; i < SIZE; ++i) { |
479 |
< |
assertTrue(s.indexOf(String.valueOf(i)) >= 0); |
479 |
> |
assertTrue(s.contains(String.valueOf(i))); |
480 |
|
} |
481 |
|
} |
482 |
|
|
969 |
|
NavigableSet q = populatedSet(SIZE); |
970 |
|
String s = q.toString(); |
971 |
|
for (int i = 0; i < SIZE; ++i) { |
972 |
< |
assertTrue(s.indexOf(String.valueOf(i)) >= 0); |
972 |
> |
assertTrue(s.contains(String.valueOf(i))); |
973 |
|
} |
974 |
|
} |
975 |
|
|