4 |
|
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
– |
import junit.framework.*; |
7 |
|
import java.util.Arrays; |
8 |
|
import java.util.BitSet; |
9 |
|
import java.util.Collection; |
16 |
|
import java.util.SortedSet; |
17 |
|
import java.util.TreeSet; |
18 |
|
|
19 |
+ |
import junit.framework.Test; |
20 |
+ |
import junit.framework.TestSuite; |
21 |
+ |
|
22 |
|
public class TreeSetTest extends JSR166TestCase { |
23 |
|
public static void main(String[] args) { |
24 |
|
junit.textui.TestRunner.run(suite()); |
538 |
|
NavigableSet x = populatedSet(SIZE); |
539 |
|
NavigableSet y = serialClone(x); |
540 |
|
|
541 |
< |
assertTrue(x != y); |
541 |
> |
assertNotSame(x, y); |
542 |
|
assertEquals(x.size(), y.size()); |
543 |
|
assertEquals(x, y); |
544 |
|
assertEquals(y, x); |
693 |
|
0, setSize - 1, true); |
694 |
|
} |
695 |
|
|
696 |
+ |
/** |
697 |
+ |
* addAll is idempotent |
698 |
+ |
*/ |
699 |
+ |
public void testAddAll_idempotent() throws Exception { |
700 |
+ |
Set x = populatedSet(SIZE); |
701 |
+ |
Set y = new TreeSet(x); |
702 |
+ |
y.addAll(x); |
703 |
+ |
assertEquals(x, y); |
704 |
+ |
assertEquals(y, x); |
705 |
+ |
} |
706 |
+ |
|
707 |
|
static NavigableSet<Integer> newSet(Class cl) throws Exception { |
708 |
|
NavigableSet<Integer> result = (NavigableSet<Integer>) cl.newInstance(); |
709 |
|
assertEquals(0, result.size()); |