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.10 by jsr166, Sat Nov 21 10:25:05 2009 UTC vs.
Revision 1.11 by jsr166, Sat Nov 21 17:38:06 2009 UTC

# Line 516 | Line 516 | public class TreeMapTest extends JSR166T
516          try {
517              e.setValue("A");
518              shouldThrow();
519 <        } catch (Exception ok) {
520 <        }
519 >        } catch (UnsupportedOperationException success) {}
520          e = map.pollFirstEntry();
521          assertNull(e);
522      }
# Line 544 | Line 543 | public class TreeMapTest extends JSR166T
543          try {
544              e.setValue("E");
545              shouldThrow();
546 <        } catch (Exception ok) {
548 <        }
546 >        } catch (UnsupportedOperationException success) {}
547          e = map.pollLastEntry();
548          assertNull(e);
549      }
# Line 581 | Line 579 | public class TreeMapTest extends JSR166T
579              TreeMap c = map5();
580              c.get(null);
581              shouldThrow();
582 <        } catch (NullPointerException e) {}
582 >        } catch (NullPointerException success) {}
583      }
584  
585      /**
# Line 592 | Line 590 | public class TreeMapTest extends JSR166T
590              TreeMap c = map5();
591              c.containsKey(null);
592              shouldThrow();
593 <        } catch (NullPointerException e) {}
593 >        } catch (NullPointerException success) {}
594      }
595  
596      /**
# Line 604 | Line 602 | public class TreeMapTest extends JSR166T
602              c.put("sadsdf", "asdads");
603              c.remove(null);
604              shouldThrow();
605 <        } catch (NullPointerException e) {}
605 >        } catch (NullPointerException success) {}
606      }
607  
608      /**
# Line 789 | Line 787 | public class TreeMapTest extends JSR166T
787      /**
788       * Submaps of submaps subdivide correctly
789       */
790 <    public void testRecursiveSubMaps() {
790 >    public void testRecursiveSubMaps() throws Exception {
791          int mapSize = 1000;
792          Class cl = TreeMap.class;
793          NavigableMap<Integer, Integer> map = newMap(cl);
# Line 807 | Line 805 | public class TreeMapTest extends JSR166T
805                     0, mapSize - 1, true);
806      }
807  
808 <    static NavigableMap<Integer, Integer> newMap(Class cl) {
809 <        NavigableMap<Integer, Integer> result = null;
810 <        try {
813 <            result = (NavigableMap<Integer, Integer>) cl.newInstance();
814 <        } catch (Exception e) {
815 <            fail();
816 <        }
808 >    static NavigableMap<Integer, Integer> newMap(Class cl) throws Exception {
809 >        NavigableMap<Integer, Integer> result
810 >            = (NavigableMap<Integer, Integer>) cl.newInstance();
811          assertEquals(result.size(), 0);
812          assertFalse(result.keySet().iterator().hasNext());
813          return result;
# Line 876 | Line 870 | public class TreeMapTest extends JSR166T
870              } else {
871                  try {
872                      map.put(key, 2 * key);
873 <                    fail();
874 <                } catch (IllegalArgumentException e) {
881 <                    // expected
882 <                }
873 >                    shouldThrow();
874 >                } catch (IllegalArgumentException success) {}
875              }
876          }
877      }
# Line 1074 | Line 1066 | public class TreeMapTest extends JSR166T
1066              assertEq(rs.last(),  -1);
1067              try {
1068                  map.firstKey();
1069 <                fail();
1070 <            } catch (NoSuchElementException e) {
1079 <                // expected
1080 <            }
1069 >                shouldThrow();
1070 >            } catch (NoSuchElementException success) {}
1071              try {
1072                  map.lastKey();
1073 <                fail();
1074 <            } catch (NoSuchElementException e) {
1085 <                // expected
1086 <            }
1073 >                shouldThrow();
1074 >            } catch (NoSuchElementException success) {}
1075          }
1076      }
1077  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines