4 |
|
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
< |
import junit.framework.*; |
8 |
< |
import java.util.*; |
7 |
> |
import java.util.ArrayList; |
8 |
> |
import java.util.Arrays; |
9 |
> |
import java.util.Collection; |
10 |
> |
import java.util.Iterator; |
11 |
> |
import java.util.Map; |
12 |
> |
import java.util.NavigableMap; |
13 |
> |
import java.util.Set; |
14 |
> |
import java.util.SortedMap; |
15 |
> |
import java.util.TreeMap; |
16 |
> |
|
17 |
> |
import junit.framework.Test; |
18 |
> |
import junit.framework.TestSuite; |
19 |
|
|
20 |
|
public class TreeSubMapTest extends JSR166TestCase { |
21 |
|
public static void main(String[] args) { |
22 |
< |
junit.textui.TestRunner.run(suite()); |
22 |
> |
main(suite(), args); |
23 |
|
} |
24 |
|
public static Test suite() { |
25 |
|
return new TestSuite(TreeSubMapTest.class); |
392 |
|
* get(null) of nonempty map throws NPE |
393 |
|
*/ |
394 |
|
public void testGet_NullPointerException() { |
395 |
+ |
NavigableMap c = map5(); |
396 |
|
try { |
386 |
– |
NavigableMap c = map5(); |
397 |
|
c.get(null); |
398 |
|
shouldThrow(); |
399 |
|
} catch (NullPointerException success) {} |
403 |
|
* containsKey(null) of nonempty map throws NPE |
404 |
|
*/ |
405 |
|
public void testContainsKey_NullPointerException() { |
406 |
+ |
NavigableMap c = map5(); |
407 |
|
try { |
397 |
– |
NavigableMap c = map5(); |
408 |
|
c.containsKey(null); |
409 |
|
shouldThrow(); |
410 |
|
} catch (NullPointerException success) {} |
414 |
|
* put(null,x) throws NPE |
415 |
|
*/ |
416 |
|
public void testPut1_NullPointerException() { |
417 |
+ |
NavigableMap c = map5(); |
418 |
|
try { |
408 |
– |
NavigableMap c = map5(); |
419 |
|
c.put(null, "whatever"); |
420 |
|
shouldThrow(); |
421 |
|
} catch (NullPointerException success) {} |
425 |
|
* remove(null) throws NPE |
426 |
|
*/ |
427 |
|
public void testRemove1_NullPointerException() { |
428 |
+ |
NavigableMap c = map5(); |
429 |
|
try { |
419 |
– |
NavigableMap c = map5(); |
430 |
|
c.remove(null); |
431 |
|
shouldThrow(); |
432 |
|
} catch (NullPointerException success) {} |
439 |
|
NavigableMap x = map5(); |
440 |
|
NavigableMap y = serialClone(x); |
441 |
|
|
442 |
< |
assertTrue(x != y); |
442 |
> |
assertNotSame(x, y); |
443 |
|
assertEquals(x.size(), y.size()); |
444 |
|
assertEquals(x.toString(), y.toString()); |
445 |
|
assertEquals(x, y); |
941 |
|
* get(null) of nonempty map throws NPE |
942 |
|
*/ |
943 |
|
public void testDescendingGet_NullPointerException() { |
944 |
+ |
NavigableMap c = dmap5(); |
945 |
|
try { |
935 |
– |
NavigableMap c = dmap5(); |
946 |
|
c.get(null); |
947 |
|
shouldThrow(); |
948 |
|
} catch (NullPointerException success) {} |
952 |
|
* put(null,x) throws NPE |
953 |
|
*/ |
954 |
|
public void testDescendingPut1_NullPointerException() { |
955 |
+ |
NavigableMap c = dmap5(); |
956 |
|
try { |
946 |
– |
NavigableMap c = dmap5(); |
957 |
|
c.put(null, "whatever"); |
958 |
|
shouldThrow(); |
959 |
|
} catch (NullPointerException success) {} |
966 |
|
NavigableMap x = dmap5(); |
967 |
|
NavigableMap y = serialClone(x); |
968 |
|
|
969 |
< |
assertTrue(x != y); |
969 |
> |
assertNotSame(x, y); |
970 |
|
assertEquals(x.size(), y.size()); |
971 |
|
assertEquals(x.toString(), y.toString()); |
972 |
|
assertEquals(x, y); |