[cvs] / jsr166 / src / test / tck / ConcurrentSkipListSetTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/ConcurrentSkipListSetTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7, Sat Nov 21 02:07:26 2009 UTC revision 1.8, Sat Nov 21 10:25:05 2009 UTC
# Line 72  Line 72 
72          try {          try {
73              ConcurrentSkipListSet q = new ConcurrentSkipListSet((Collection)null);              ConcurrentSkipListSet q = new ConcurrentSkipListSet((Collection)null);
74              shouldThrow();              shouldThrow();
75          }          } catch (NullPointerException success) {}
         catch (NullPointerException success) {}  
76      }      }
77    
78      /**      /**
# Line 84  Line 83 
83              Integer[] ints = new Integer[SIZE];              Integer[] ints = new Integer[SIZE];
84              ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints));              ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints));
85              shouldThrow();              shouldThrow();
86          }          } catch (NullPointerException success) {}
         catch (NullPointerException success) {}  
87      }      }
88    
89      /**      /**
# Line 98  Line 96 
96                  ints[i] = new Integer(i);                  ints[i] = new Integer(i);
97              ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints));              ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints));
98              shouldThrow();              shouldThrow();
99          }          } catch (NullPointerException success) {}
         catch (NullPointerException success) {}  
100      }      }
101    
102      /**      /**
103       * Set contains all elements of collection used to initialize       * Set contains all elements of collection used to initialize
104       */       */
105      public void testConstructor6() {      public void testConstructor6() {
         try {  
106              Integer[] ints = new Integer[SIZE];              Integer[] ints = new Integer[SIZE];
107              for (int i = 0; i < SIZE; ++i)              for (int i = 0; i < SIZE; ++i)
108                  ints[i] = new Integer(i);                  ints[i] = new Integer(i);
# Line 114  Line 110 
110              for (int i = 0; i < SIZE; ++i)              for (int i = 0; i < SIZE; ++i)
111                  assertEquals(ints[i], q.pollFirst());                  assertEquals(ints[i], q.pollFirst());
112          }          }
         finally {}  
     }  
113    
114      /**      /**
115       * The comparator used in constructor is used       * The comparator used in constructor is used
# Line 203  Line 197 
197              q.add(new Object());              q.add(new Object());
198              q.add(new Object());              q.add(new Object());
199              shouldThrow();              shouldThrow();
200          }          } catch (ClassCastException success) {}
         catch (ClassCastException success) {}  
201      }      }
202    
203      /**      /**
# Line 215  Line 208 
208              ConcurrentSkipListSet q = new ConcurrentSkipListSet();              ConcurrentSkipListSet q = new ConcurrentSkipListSet();
209              q.addAll(null);              q.addAll(null);
210              shouldThrow();              shouldThrow();
211          }          } catch (NullPointerException success) {}
         catch (NullPointerException success) {}  
212      }      }
213      /**      /**
214       * addAll of a collection with null elements throws NPE       * addAll of a collection with null elements throws NPE
# Line 227  Line 219 
219              Integer[] ints = new Integer[SIZE];              Integer[] ints = new Integer[SIZE];
220              q.addAll(Arrays.asList(ints));              q.addAll(Arrays.asList(ints));
221              shouldThrow();              shouldThrow();
222          }          } catch (NullPointerException success) {}
         catch (NullPointerException success) {}  
223      }      }
224      /**      /**
225       * addAll of a collection with any null elements throws NPE after       * addAll of a collection with any null elements throws NPE after
# Line 242  Line 233 
233                  ints[i] = new Integer(i);                  ints[i] = new Integer(i);
234              q.addAll(Arrays.asList(ints));              q.addAll(Arrays.asList(ints));
235              shouldThrow();              shouldThrow();
236          }          } catch (NullPointerException success) {}
         catch (NullPointerException success) {}  
237      }      }
238    
239      /**      /**
# Line 540  Line 530 
530      /**      /**
531       * A deserialized serialized set has same elements       * A deserialized serialized set has same elements
532       */       */
533      public void testSerialization() {      public void testSerialization() throws Exception {
534          ConcurrentSkipListSet q = populatedSet(SIZE);          ConcurrentSkipListSet q = populatedSet(SIZE);
         try {  
535              ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);              ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
536              ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));              ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
537              out.writeObject(q);              out.writeObject(q);
# Line 554  Line 543 
543              assertEquals(q.size(), r.size());              assertEquals(q.size(), r.size());
544              while (!q.isEmpty())              while (!q.isEmpty())
545                  assertEquals(q.pollFirst(), r.pollFirst());                  assertEquals(q.pollFirst(), r.pollFirst());
         } catch (Exception e) {  
             e.printStackTrace();  
             unexpectedException();  
         }  
546      }      }
547    
548      /**      /**

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8