ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/TreeMapTest.java
(Generate patch)

Comparing jsr166/src/test/tck/TreeMapTest.java (file contents):
Revision 1.27 by jsr166, Thu May 30 03:28:55 2013 UTC vs.
Revision 1.31 by jsr166, Sat Apr 25 04:55:31 2015 UTC

# Line 4 | Line 4
4   * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7 < import junit.framework.*;
8 < import java.util.*;
7 > import java.util.Arrays;
8 > import java.util.BitSet;
9 > import java.util.Collection;
10 > import java.util.Iterator;
11 > import java.util.Map;
12 > import java.util.NavigableMap;
13 > import java.util.NavigableSet;
14 > import java.util.NoSuchElementException;
15 > import java.util.Random;
16 > import java.util.Set;
17 > import java.util.TreeMap;
18 >
19 > import junit.framework.Test;
20 > import junit.framework.TestSuite;
21  
22   public class TreeMapTest extends JSR166TestCase {
23      public static void main(String[] args) {
24 <        junit.textui.TestRunner.run(suite());
24 >        main(suite(), args);
25      }
26      public static Test suite() {
27          return new TestSuite(TreeMapTest.class);
# Line 563 | Line 575 | public class TreeMapTest extends JSR166T
575       * get(null) of nonempty map throws NPE
576       */
577      public void testGet_NullPointerException() {
578 +        TreeMap c = map5();
579          try {
567            TreeMap c = map5();
580              c.get(null);
581              shouldThrow();
582          } catch (NullPointerException success) {}
# Line 574 | Line 586 | public class TreeMapTest extends JSR166T
586       * containsKey(null) of nonempty map throws NPE
587       */
588      public void testContainsKey_NullPointerException() {
589 +        TreeMap c = map5();
590          try {
578            TreeMap c = map5();
591              c.containsKey(null);
592              shouldThrow();
593          } catch (NullPointerException success) {}
# Line 585 | Line 597 | public class TreeMapTest extends JSR166T
597       * remove(null) throws NPE for nonempty map
598       */
599      public void testRemove1_NullPointerException() {
600 +        TreeMap c = new TreeMap();
601 +        c.put("sadsdf", "asdads");
602          try {
589            TreeMap c = new TreeMap();
590            c.put("sadsdf", "asdads");
603              c.remove(null);
604              shouldThrow();
605          } catch (NullPointerException success) {}
# Line 823 | Line 835 | public class TreeMapTest extends JSR166T
835          // Add entries till we're back to original size
836          while (map.size() < size) {
837              int key = min + rnd.nextInt(rangeSize);
838 <            assertTrue(key >= min && key<= max);
838 >            assertTrue(key >= min && key <= max);
839              put(map, key);
840          }
841      }
# Line 848 | Line 860 | public class TreeMapTest extends JSR166T
860          // Add entries till we're back to original size
861          while (map.size() < size) {
862              int key = min - 5 + rnd.nextInt(rangeSize + 10);
863 <            if (key >= min && key<= max) {
863 >            if (key >= min && key <= max) {
864                  put(map, key);
865              } else {
866                  try {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines