17 |
|
import java.util.TreeMap; |
18 |
|
|
19 |
|
import junit.framework.Test; |
20 |
– |
import junit.framework.TestSuite; |
20 |
|
|
21 |
|
public class TreeMapTest extends JSR166TestCase { |
22 |
|
public static void main(String[] args) { |
23 |
< |
junit.textui.TestRunner.run(suite()); |
23 |
> |
main(suite(), args); |
24 |
|
} |
25 |
|
public static Test suite() { |
26 |
< |
return new TestSuite(TreeMapTest.class); |
26 |
> |
class Implementation implements MapImplementation { |
27 |
> |
public Class<?> klazz() { return TreeMap.class; } |
28 |
> |
public Map emptyMap() { return new TreeMap(); } |
29 |
> |
public Object makeKey(int i) { return i; } |
30 |
> |
public Object makeValue(int i) { return i; } |
31 |
> |
public boolean isConcurrent() { return false; } |
32 |
> |
public boolean permitsNullKeys() { return false; } |
33 |
> |
public boolean permitsNullValues() { return true; } |
34 |
> |
public boolean supportsSetValue() { return true; } |
35 |
> |
} |
36 |
> |
return newTestSuite( |
37 |
> |
TreeMapTest.class, |
38 |
> |
MapTest.testSuite(new Implementation())); |
39 |
|
} |
40 |
|
|
41 |
|
/** |
617 |
|
} |
618 |
|
|
619 |
|
/** |
620 |
< |
* A deserialized map equals original |
620 |
> |
* A deserialized/reserialized map equals original |
621 |
|
*/ |
622 |
|
public void testSerialization() throws Exception { |
623 |
|
NavigableMap x = map5(); |
813 |
|
|
814 |
|
static NavigableMap<Integer, Integer> newMap(Class cl) throws Exception { |
815 |
|
NavigableMap<Integer, Integer> result |
816 |
< |
= (NavigableMap<Integer, Integer>) cl.newInstance(); |
816 |
> |
= (NavigableMap<Integer, Integer>) cl.getConstructor().newInstance(); |
817 |
|
assertEquals(0, result.size()); |
818 |
|
assertFalse(result.keySet().iterator().hasNext()); |
819 |
|
return result; |