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

Comparing jsr166/src/test/tck/ConcurrentSkipListSubMapTest.java (file contents):
Revision 1.5 by dl, Thu Apr 20 20:35:00 2006 UTC vs.
Revision 1.8 by jsr166, Mon Nov 16 05:30:07 2009 UTC

# Line 11 | Line 11 | import java.io.*;
11  
12   public class ConcurrentSkipListSubMapTest extends JSR166TestCase {
13      public static void main(String[] args) {
14 <        junit.textui.TestRunner.run (suite());  
14 >        junit.textui.TestRunner.run (suite());
15      }
16      public static Test suite() {
17          return new TestSuite(ConcurrentSkipListSubMapTest.class);
# Line 20 | Line 20 | public class ConcurrentSkipListSubMapTes
20      /**
21       * Create a map from Integers 1-5 to Strings "A"-"E".
22       */
23 <    private static ConcurrentNavigableMap map5() {  
23 >    private static ConcurrentNavigableMap map5() {
24          ConcurrentSkipListMap map = new ConcurrentSkipListMap();
25          assertTrue(map.isEmpty());
26          map.put(zero, "Z");
# Line 38 | Line 38 | public class ConcurrentSkipListSubMapTes
38      /**
39       * Create a map from Integers -5 to -1 to Strings "A"-"E".
40       */
41 <    private static ConcurrentNavigableMap dmap5() {  
41 >    private static ConcurrentNavigableMap dmap5() {
42          ConcurrentSkipListMap map = new ConcurrentSkipListMap();
43          assertTrue(map.isEmpty());
44          map.put(m1, "A");
# Line 51 | Line 51 | public class ConcurrentSkipListSubMapTes
51          return map.descendingMap();
52      }
53  
54 <    private static ConcurrentNavigableMap map0() {  
54 >    private static ConcurrentNavigableMap map0() {
55          ConcurrentSkipListMap map = new ConcurrentSkipListMap();
56          assertTrue(map.isEmpty());
57          return map.tailMap(one, true);
58      }
59  
60 <    private static ConcurrentNavigableMap dmap0() {  
60 >    private static ConcurrentNavigableMap dmap0() {
61          ConcurrentSkipListMap map = new ConcurrentSkipListMap();
62          assertTrue(map.isEmpty());
63          return map;
# Line 239 | Line 239 | public class ConcurrentSkipListSubMapTes
239          Iterator it = s.iterator();
240          while (it.hasNext()) {
241              Map.Entry e = (Map.Entry) it.next();
242 <            assertTrue(
242 >            assertTrue(
243                         (e.getKey().equals(one) && e.getValue().equals("A")) ||
244                         (e.getKey().equals(two) && e.getValue().equals("B")) ||
245                         (e.getKey().equals(three) && e.getValue().equals("C")) ||
# Line 497 | Line 497 | public class ConcurrentSkipListSubMapTes
497          for (int i = 1; i <= 5; ++i) {
498              assertTrue(s.indexOf(String.valueOf(i)) >= 0);
499          }
500 <    }        
500 >    }
501  
502      // Exception tests
503  
# Line 509 | Line 509 | public class ConcurrentSkipListSubMapTes
509              ConcurrentNavigableMap c = map5();
510              c.get(null);
511              shouldThrow();
512 <        } catch(NullPointerException e){}
512 >        } catch (NullPointerException e) {}
513      }
514  
515      /**
# Line 520 | Line 520 | public class ConcurrentSkipListSubMapTes
520              ConcurrentNavigableMap c = map5();
521              c.containsKey(null);
522              shouldThrow();
523 <        } catch(NullPointerException e){}
523 >        } catch (NullPointerException e) {}
524      }
525  
526      /**
# Line 531 | Line 531 | public class ConcurrentSkipListSubMapTes
531              ConcurrentNavigableMap c = map0();
532              c.containsValue(null);
533              shouldThrow();
534 <        } catch(NullPointerException e){}
534 >        } catch (NullPointerException e) {}
535      }
536  
537  
# Line 543 | Line 543 | public class ConcurrentSkipListSubMapTes
543              ConcurrentNavigableMap c = map5();
544              c.put(null, "whatever");
545              shouldThrow();
546 <        } catch(NullPointerException e){}
546 >        } catch (NullPointerException e) {}
547      }
548  
549      /**
# Line 554 | Line 554 | public class ConcurrentSkipListSubMapTes
554              ConcurrentNavigableMap c = map5();
555              c.putIfAbsent(null, "whatever");
556              shouldThrow();
557 <        } catch(NullPointerException e){}
557 >        } catch (NullPointerException e) {}
558      }
559  
560      /**
# Line 565 | Line 565 | public class ConcurrentSkipListSubMapTes
565              ConcurrentNavigableMap c = map5();
566              c.replace(null, "whatever");
567              shouldThrow();
568 <        } catch(NullPointerException e){}
568 >        } catch (NullPointerException e) {}
569      }
570  
571      /**
# Line 576 | Line 576 | public class ConcurrentSkipListSubMapTes
576              ConcurrentNavigableMap c = map5();
577              c.replace(null, one, "whatever");
578              shouldThrow();
579 <        } catch(NullPointerException e){}
579 >        } catch (NullPointerException e) {}
580      }
581  
582      /**
# Line 587 | Line 587 | public class ConcurrentSkipListSubMapTes
587              ConcurrentNavigableMap c = map5();
588              c.remove(null);
589              shouldThrow();
590 <        } catch(NullPointerException e){}
590 >        } catch (NullPointerException e) {}
591      }
592  
593      /**
# Line 598 | Line 598 | public class ConcurrentSkipListSubMapTes
598              ConcurrentNavigableMap c = map5();
599              c.remove(null, "whatever");
600              shouldThrow();
601 <        } catch(NullPointerException e){}
601 >        } catch (NullPointerException e) {}
602      }
603  
604      /**
# Line 619 | Line 619 | public class ConcurrentSkipListSubMapTes
619              assertEquals(q.size(), r.size());
620              assertTrue(q.equals(r));
621              assertTrue(r.equals(q));
622 <        } catch(Exception e){
622 >        } catch (Exception e) {
623              e.printStackTrace();
624              unexpectedException();
625          }
# Line 938 | Line 938 | public class ConcurrentSkipListSubMapTes
938          Iterator it = s.iterator();
939          while (it.hasNext()) {
940              Map.Entry e = (Map.Entry) it.next();
941 <            assertTrue(
941 >            assertTrue(
942                         (e.getKey().equals(m1) && e.getValue().equals("A")) ||
943                         (e.getKey().equals(m2) && e.getValue().equals("B")) ||
944                         (e.getKey().equals(m3) && e.getValue().equals("C")) ||
# Line 1196 | Line 1196 | public class ConcurrentSkipListSubMapTes
1196          for (int i = 1; i <= 5; ++i) {
1197              assertTrue(s.indexOf(String.valueOf(i)) >= 0);
1198          }
1199 <    }        
1199 >    }
1200  
1201      // Exception testDescendings
1202  
# Line 1208 | Line 1208 | public class ConcurrentSkipListSubMapTes
1208              ConcurrentNavigableMap c = dmap5();
1209              c.get(null);
1210              shouldThrow();
1211 <        } catch(NullPointerException e){}
1211 >        } catch (NullPointerException e) {}
1212      }
1213  
1214      /**
# Line 1219 | Line 1219 | public class ConcurrentSkipListSubMapTes
1219              ConcurrentNavigableMap c = dmap5();
1220              c.containsKey(null);
1221              shouldThrow();
1222 <        } catch(NullPointerException e){}
1222 >        } catch (NullPointerException e) {}
1223      }
1224  
1225      /**
# Line 1230 | Line 1230 | public class ConcurrentSkipListSubMapTes
1230              ConcurrentNavigableMap c = dmap0();
1231              c.containsValue(null);
1232              shouldThrow();
1233 <        } catch(NullPointerException e){}
1233 >        } catch (NullPointerException e) {}
1234      }
1235  
1236  
# Line 1242 | Line 1242 | public class ConcurrentSkipListSubMapTes
1242              ConcurrentNavigableMap c = dmap5();
1243              c.put(null, "whatever");
1244              shouldThrow();
1245 <        } catch(NullPointerException e){}
1245 >        } catch (NullPointerException e) {}
1246      }
1247  
1248      /**
# Line 1253 | Line 1253 | public class ConcurrentSkipListSubMapTes
1253              ConcurrentNavigableMap c = dmap5();
1254              c.putIfAbsent(null, "whatever");
1255              shouldThrow();
1256 <        } catch(NullPointerException e){}
1256 >        } catch (NullPointerException e) {}
1257      }
1258  
1259      /**
# Line 1264 | Line 1264 | public class ConcurrentSkipListSubMapTes
1264              ConcurrentNavigableMap c = dmap5();
1265              c.replace(null, "whatever");
1266              shouldThrow();
1267 <        } catch(NullPointerException e){}
1267 >        } catch (NullPointerException e) {}
1268      }
1269  
1270      /**
# Line 1275 | Line 1275 | public class ConcurrentSkipListSubMapTes
1275              ConcurrentNavigableMap c = dmap5();
1276              c.replace(null, m1, "whatever");
1277              shouldThrow();
1278 <        } catch(NullPointerException e){}
1278 >        } catch (NullPointerException e) {}
1279      }
1280  
1281      /**
# Line 1286 | Line 1286 | public class ConcurrentSkipListSubMapTes
1286              ConcurrentNavigableMap c = dmap5();
1287              c.remove(null);
1288              shouldThrow();
1289 <        } catch(NullPointerException e){}
1289 >        } catch (NullPointerException e) {}
1290      }
1291  
1292      /**
# Line 1297 | Line 1297 | public class ConcurrentSkipListSubMapTes
1297              ConcurrentNavigableMap c = dmap5();
1298              c.remove(null, "whatever");
1299              shouldThrow();
1300 <        } catch(NullPointerException e){}
1300 >        } catch (NullPointerException e) {}
1301      }
1302  
1303      /**
# Line 1318 | Line 1318 | public class ConcurrentSkipListSubMapTes
1318              assertEquals(q.size(), r.size());
1319              assertTrue(q.equals(r));
1320              assertTrue(r.equals(q));
1321 <        } catch(Exception e){
1321 >        } catch (Exception e) {
1322              e.printStackTrace();
1323              unexpectedException();
1324          }
# Line 1460 | Line 1460 | public class ConcurrentSkipListSubMapTes
1460          assertEquals(3, sm.size());
1461          assertEquals(4, map.size());
1462      }
1463 <    
1463 >
1464   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines