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

Comparing jsr166/src/test/tck/ConcurrentSkipListMapTest.java (file contents):
Revision 1.13 by jsr166, Sat Nov 21 10:25:05 2009 UTC vs.
Revision 1.14 by jsr166, Sat Nov 21 17:38:05 2009 UTC

# Line 516 | Line 516 | public class ConcurrentSkipListMapTest e
516          assertEquals(two, e.getKey());
517          try {
518              e.setValue("X");
519 <            fail();
519 >            shouldThrow();
520          } catch (UnsupportedOperationException success) {}
521          e = map.higherEntry(zero);
522          assertEquals(one, e.getKey());
523          try {
524              e.setValue("X");
525 <            fail();
525 >            shouldThrow();
526          } catch (UnsupportedOperationException success) {}
527          e = map.floorEntry(one);
528          assertEquals(one, e.getKey());
529          try {
530              e.setValue("X");
531 <            fail();
531 >            shouldThrow();
532          } catch (UnsupportedOperationException success) {}
533          e = map.ceilingEntry(five);
534          assertEquals(five, e.getKey());
535          try {
536              e.setValue("X");
537 <            fail();
537 >            shouldThrow();
538          } catch (UnsupportedOperationException success) {}
539      }
540  
# Line 638 | Line 638 | public class ConcurrentSkipListMapTest e
638          try {
639              e.setValue("A");
640              shouldThrow();
641 <        } catch (Exception ok) {
642 <        }
641 >        } catch (UnsupportedOperationException success) {}
642          e = map.pollFirstEntry();
643          assertNull(e);
644      }
# Line 666 | Line 665 | public class ConcurrentSkipListMapTest e
665          try {
666              e.setValue("E");
667              shouldThrow();
668 <        } catch (Exception ok) {
670 <        }
668 >        } catch (UnsupportedOperationException success) {}
669          e = map.pollLastEntry();
670          assertNull(e);
671      }
# Line 703 | Line 701 | public class ConcurrentSkipListMapTest e
701              ConcurrentSkipListMap c = map5();
702              c.get(null);
703              shouldThrow();
704 <        } catch (NullPointerException e) {}
704 >        } catch (NullPointerException success) {}
705      }
706  
707      /**
# Line 714 | Line 712 | public class ConcurrentSkipListMapTest e
712              ConcurrentSkipListMap c = map5();
713              c.containsKey(null);
714              shouldThrow();
715 <        } catch (NullPointerException e) {}
715 >        } catch (NullPointerException success) {}
716      }
717  
718      /**
# Line 725 | Line 723 | public class ConcurrentSkipListMapTest e
723              ConcurrentSkipListMap c = new ConcurrentSkipListMap();
724              c.containsValue(null);
725              shouldThrow();
726 <        } catch (NullPointerException e) {}
726 >        } catch (NullPointerException success) {}
727      }
728  
729  
# Line 737 | Line 735 | public class ConcurrentSkipListMapTest e
735              ConcurrentSkipListMap c = map5();
736              c.put(null, "whatever");
737              shouldThrow();
738 <        } catch (NullPointerException e) {}
738 >        } catch (NullPointerException success) {}
739      }
740  
741      /**
# Line 748 | Line 746 | public class ConcurrentSkipListMapTest e
746              ConcurrentSkipListMap c = map5();
747              c.putIfAbsent(null, "whatever");
748              shouldThrow();
749 <        } catch (NullPointerException e) {}
749 >        } catch (NullPointerException success) {}
750      }
751  
752      /**
# Line 759 | Line 757 | public class ConcurrentSkipListMapTest e
757              ConcurrentSkipListMap c = map5();
758              c.replace(null, "whatever");
759              shouldThrow();
760 <        } catch (NullPointerException e) {}
760 >        } catch (NullPointerException success) {}
761      }
762  
763      /**
# Line 770 | Line 768 | public class ConcurrentSkipListMapTest e
768              ConcurrentSkipListMap c = map5();
769              c.replace(null, one, "whatever");
770              shouldThrow();
771 <        } catch (NullPointerException e) {}
771 >        } catch (NullPointerException success) {}
772      }
773  
774      /**
# Line 782 | Line 780 | public class ConcurrentSkipListMapTest e
780              c.put("sadsdf", "asdads");
781              c.remove(null);
782              shouldThrow();
783 <        } catch (NullPointerException e) {}
783 >        } catch (NullPointerException success) {}
784      }
785  
786      /**
# Line 794 | Line 792 | public class ConcurrentSkipListMapTest e
792              c.put("sadsdf", "asdads");
793              c.remove(null, "whatever");
794              shouldThrow();
795 <        } catch (NullPointerException e) {}
795 >        } catch (NullPointerException success) {}
796      }
797  
798      /**
799       * remove(x, null) returns false
800       */
801      public void testRemove3() {
802 <        try {
803 <            ConcurrentSkipListMap c = new ConcurrentSkipListMap();
804 <            c.put("sadsdf", "asdads");
807 <            assertFalse(c.remove("sadsdf", null));
808 <        } catch (NullPointerException e) {
809 <            fail();
810 <        }
802 >        ConcurrentSkipListMap c = new ConcurrentSkipListMap();
803 >        c.put("sadsdf", "asdads");
804 >        assertFalse(c.remove("sadsdf", null));
805      }
806  
807      /**
# Line 994 | Line 988 | public class ConcurrentSkipListMapTest e
988      /**
989       * Submaps of submaps subdivide correctly
990       */
991 <    public void testRecursiveSubMaps() {
991 >    public void testRecursiveSubMaps() throws Exception {
992          int mapSize = 1000;
993          Class cl = ConcurrentSkipListMap.class;
994          NavigableMap<Integer, Integer> map = newMap(cl);
# Line 1012 | Line 1006 | public class ConcurrentSkipListMapTest e
1006                     0, mapSize - 1, true);
1007      }
1008  
1009 <    static NavigableMap<Integer, Integer> newMap(Class cl) {
1010 <        NavigableMap<Integer, Integer> result = null;
1011 <        try {
1018 <            result = (NavigableMap<Integer, Integer>) cl.newInstance();
1019 <        } catch (Exception e) {
1020 <            fail();
1021 <        }
1009 >    static NavigableMap<Integer, Integer> newMap(Class cl) throws Exception {
1010 >        NavigableMap<Integer, Integer> result =
1011 >            (NavigableMap<Integer, Integer>) cl.newInstance();
1012          assertEquals(result.size(), 0);
1013          assertFalse(result.keySet().iterator().hasNext());
1014          return result;
# Line 1081 | Line 1071 | public class ConcurrentSkipListMapTest e
1071              } else {
1072                  try {
1073                      map.put(key, 2 * key);
1074 <                    fail();
1075 <                } catch (IllegalArgumentException e) {
1086 <                    // expected
1087 <                }
1074 >                    shouldThrow();
1075 >                } catch (IllegalArgumentException success) {}
1076              }
1077          }
1078      }
# Line 1279 | Line 1267 | public class ConcurrentSkipListMapTest e
1267              assertEq(rs.last(),  -1);
1268              try {
1269                  map.firstKey();
1270 <                fail();
1271 <            } catch (NoSuchElementException e) {
1284 <                // expected
1285 <            }
1270 >                shouldThrow();
1271 >            } catch (NoSuchElementException success) {}
1272              try {
1273                  map.lastKey();
1274 <                fail();
1275 <            } catch (NoSuchElementException e) {
1290 <                // expected
1291 <            }
1274 >                shouldThrow();
1275 >            } catch (NoSuchElementException success) {}
1276          }
1277      }
1278  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines