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

Comparing jsr166/src/test/tck/ConcurrentSkipListSubSetTest.java (file contents):
Revision 1.8 by jsr166, Sat Nov 21 02:07:26 2009 UTC vs.
Revision 1.9 by jsr166, Sat Nov 21 10:25:05 2009 UTC

# Line 138 | Line 138 | public class ConcurrentSkipListSubSetTes
138              NavigableSet q = set0();
139              q.add(null);
140              shouldThrow();
141 <        } catch (NullPointerException success) { }
141 >        } catch (NullPointerException success) {}
142      }
143  
144      /**
# Line 168 | Line 168 | public class ConcurrentSkipListSubSetTes
168              q.add(new Object());
169              q.add(new Object());
170              shouldThrow();
171 <        }
172 <        catch (ClassCastException success) {}
171 >        } catch (ClassCastException success) {}
172      }
173  
174  
# Line 181 | Line 180 | public class ConcurrentSkipListSubSetTes
180              NavigableSet q = set0();
181              q.addAll(null);
182              shouldThrow();
183 <        }
185 <        catch (NullPointerException success) {}
183 >        } catch (NullPointerException success) {}
184      }
185      /**
186       * addAll of a collection with null elements throws NPE
# Line 193 | Line 191 | public class ConcurrentSkipListSubSetTes
191              Integer[] ints = new Integer[SIZE];
192              q.addAll(Arrays.asList(ints));
193              shouldThrow();
194 <        }
197 <        catch (NullPointerException success) {}
194 >        } catch (NullPointerException success) {}
195      }
196      /**
197       * addAll of a collection with any null elements throws NPE after
# Line 208 | Line 205 | public class ConcurrentSkipListSubSetTes
205                  ints[i] = new Integer(i+SIZE);
206              q.addAll(Arrays.asList(ints));
207              shouldThrow();
208 <        }
212 <        catch (NullPointerException success) {}
208 >        } catch (NullPointerException success) {}
209      }
210  
211      /**
# Line 494 | Line 490 | public class ConcurrentSkipListSubSetTes
490      /**
491       * A deserialized serialized set has same elements
492       */
493 <    public void testSerialization() {
493 >    public void testSerialization() throws Exception {
494          NavigableSet q = populatedSet(SIZE);
495 <        try {
496 <            ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
497 <            ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
498 <            out.writeObject(q);
499 <            out.close();
500 <
501 <            ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
502 <            ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
503 <            NavigableSet r = (NavigableSet)in.readObject();
504 <            assertEquals(q.size(), r.size());
505 <            while (!q.isEmpty())
510 <                assertEquals(q.pollFirst(), r.pollFirst());
511 <        } catch (Exception e) {
512 <            e.printStackTrace();
513 <            unexpectedException();
514 <        }
495 >        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
496 >        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
497 >        out.writeObject(q);
498 >        out.close();
499 >
500 >        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
501 >        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
502 >        NavigableSet r = (NavigableSet)in.readObject();
503 >        assertEquals(q.size(), r.size());
504 >        while (!q.isEmpty())
505 >            assertEquals(q.pollFirst(), r.pollFirst());
506      }
507  
508      /**
# Line 656 | Line 647 | public class ConcurrentSkipListSubSetTes
647              NavigableSet q = dset0();
648              q.add(null);
649              shouldThrow();
650 <        } catch (NullPointerException success) { }
650 >        } catch (NullPointerException success) {}
651      }
652  
653      /**
# Line 686 | Line 677 | public class ConcurrentSkipListSubSetTes
677              q.add(new Object());
678              q.add(new Object());
679              shouldThrow();
680 <        }
690 <        catch (ClassCastException success) {}
680 >        } catch (ClassCastException success) {}
681      }
682  
683  
# Line 699 | Line 689 | public class ConcurrentSkipListSubSetTes
689              NavigableSet q = dset0();
690              q.addAll(null);
691              shouldThrow();
692 <        }
703 <        catch (NullPointerException success) {}
692 >        } catch (NullPointerException success) {}
693      }
694      /**
695       * addAll of a collection with null elements throws NPE
# Line 711 | Line 700 | public class ConcurrentSkipListSubSetTes
700              Integer[] ints = new Integer[SIZE];
701              q.addAll(Arrays.asList(ints));
702              shouldThrow();
703 <        }
715 <        catch (NullPointerException success) {}
703 >        } catch (NullPointerException success) {}
704      }
705      /**
706       * addAll of a collection with any null elements throws NPE after
# Line 726 | Line 714 | public class ConcurrentSkipListSubSetTes
714                  ints[i] = new Integer(i+SIZE);
715              q.addAll(Arrays.asList(ints));
716              shouldThrow();
717 <        }
730 <        catch (NullPointerException success) {}
717 >        } catch (NullPointerException success) {}
718      }
719  
720      /**
# Line 1012 | Line 999 | public class ConcurrentSkipListSubSetTes
999      /**
1000       * A deserialized serialized set has same elements
1001       */
1002 <    public void testDescendingSerialization() {
1002 >    public void testDescendingSerialization() throws Exception {
1003          NavigableSet q = populatedSet(SIZE);
1004 <        try {
1005 <            ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
1006 <            ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
1007 <            out.writeObject(q);
1008 <            out.close();
1009 <
1010 <            ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
1011 <            ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
1012 <            NavigableSet r = (NavigableSet)in.readObject();
1013 <            assertEquals(q.size(), r.size());
1014 <            while (!q.isEmpty())
1028 <                assertEquals(q.pollFirst(), r.pollFirst());
1029 <        } catch (Exception e) {
1030 <            e.printStackTrace();
1031 <            unexpectedException();
1032 <        }
1004 >        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
1005 >        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
1006 >        out.writeObject(q);
1007 >        out.close();
1008 >
1009 >        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
1010 >        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
1011 >        NavigableSet r = (NavigableSet)in.readObject();
1012 >        assertEquals(q.size(), r.size());
1013 >        while (!q.isEmpty())
1014 >            assertEquals(q.pollFirst(), r.pollFirst());
1015      }
1016  
1017      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines