diff options
Diffstat (limited to 'jsr166-tests/src/test/java/jsr166/TreeMapTest.java')
-rw-r--r-- | jsr166-tests/src/test/java/jsr166/TreeMapTest.java | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/jsr166-tests/src/test/java/jsr166/TreeMapTest.java b/jsr166-tests/src/test/java/jsr166/TreeMapTest.java index 87baa1a..afc73de 100644 --- a/jsr166-tests/src/test/java/jsr166/TreeMapTest.java +++ b/jsr166-tests/src/test/java/jsr166/TreeMapTest.java @@ -6,10 +6,31 @@ package jsr166; -import junit.framework.*; -import java.util.*; +import java.util.Arrays; +import java.util.BitSet; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.NavigableMap; +import java.util.NavigableSet; +import java.util.NoSuchElementException; +import java.util.Random; +import java.util.Set; +import java.util.TreeMap; + +import junit.framework.Test; +import junit.framework.TestSuite; public class TreeMapTest extends JSR166TestCase { + // android-note: Removed because the CTS runner does a bad job of + // retrying tests that have suite() declarations. + // + // public static void main(String[] args) { + // main(suite(), args); + // } + // public static Test suite() { + // return new TestSuite(...); + // } /** * Returns a new map from Integers 1-5 to Strings "A"-"E". @@ -559,8 +580,8 @@ public class TreeMapTest extends JSR166TestCase { * get(null) of nonempty map throws NPE */ public void testGet_NullPointerException() { + TreeMap c = map5(); try { - TreeMap c = map5(); c.get(null); shouldThrow(); } catch (NullPointerException success) {} @@ -570,8 +591,8 @@ public class TreeMapTest extends JSR166TestCase { * containsKey(null) of nonempty map throws NPE */ public void testContainsKey_NullPointerException() { + TreeMap c = map5(); try { - TreeMap c = map5(); c.containsKey(null); shouldThrow(); } catch (NullPointerException success) {} @@ -581,9 +602,9 @@ public class TreeMapTest extends JSR166TestCase { * remove(null) throws NPE for nonempty map */ public void testRemove1_NullPointerException() { + TreeMap c = new TreeMap(); + c.put("sadsdf", "asdads"); try { - TreeMap c = new TreeMap(); - c.put("sadsdf", "asdads"); c.remove(null); shouldThrow(); } catch (NullPointerException success) {} @@ -819,7 +840,7 @@ public class TreeMapTest extends JSR166TestCase { // Add entries till we're back to original size while (map.size() < size) { int key = min + rnd.nextInt(rangeSize); - assertTrue(key >= min && key<= max); + assertTrue(key >= min && key <= max); put(map, key); } } @@ -844,7 +865,7 @@ public class TreeMapTest extends JSR166TestCase { // Add entries till we're back to original size while (map.size() < size) { int key = min - 5 + rnd.nextInt(rangeSize + 10); - if (key >= min && key<= max) { + if (key >= min && key <= max) { put(map, key); } else { try { |