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

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

# Line 77 | Line 77 | public class TreeSetTest extends JSR166T
77          try {
78              TreeSet q = new TreeSet((Collection)null);
79              shouldThrow();
80 <        }
81 <        catch (NullPointerException success) {}
80 >        } catch (NullPointerException success) {}
81      }
82  
83      /**
# Line 89 | Line 88 | public class TreeSetTest extends JSR166T
88              Integer[] ints = new Integer[SIZE];
89              TreeSet q = new TreeSet(Arrays.asList(ints));
90              shouldThrow();
91 <        }
93 <        catch (NullPointerException success) {}
91 >        } catch (NullPointerException success) {}
92      }
93  
94      /**
# Line 103 | Line 101 | public class TreeSetTest extends JSR166T
101                  ints[i] = new Integer(i);
102              TreeSet q = new TreeSet(Arrays.asList(ints));
103              shouldThrow();
104 <        }
107 <        catch (NullPointerException success) {}
104 >        } catch (NullPointerException success) {}
105      }
106  
107      /**
# Line 177 | Line 174 | public class TreeSetTest extends JSR166T
174              TreeSet q = populatedSet(SIZE);
175              q.add(null);
176              shouldThrow();
177 <        } catch (NullPointerException success) { }
177 >        } catch (NullPointerException success) {}
178      }
179  
180      /**
# Line 208 | Line 205 | public class TreeSetTest extends JSR166T
205              q.add(new Object());
206              q.add(new Object());
207              shouldThrow();
208 <        }
212 <        catch (ClassCastException success) {}
208 >        } catch (ClassCastException success) {}
209      }
210  
211      /**
# Line 220 | Line 216 | public class TreeSetTest extends JSR166T
216              TreeSet q = new TreeSet();
217              q.addAll(null);
218              shouldThrow();
219 <        }
224 <        catch (NullPointerException success) {}
219 >        } catch (NullPointerException success) {}
220      }
221      /**
222       * addAll of a collection with null elements throws NPE
# Line 232 | Line 227 | public class TreeSetTest extends JSR166T
227              Integer[] ints = new Integer[SIZE];
228              q.addAll(Arrays.asList(ints));
229              shouldThrow();
230 <        }
236 <        catch (NullPointerException success) {}
230 >        } catch (NullPointerException success) {}
231      }
232      /**
233       * addAll of a collection with any null elements throws NPE after
# Line 247 | Line 241 | public class TreeSetTest extends JSR166T
241                  ints[i] = new Integer(i);
242              q.addAll(Arrays.asList(ints));
243              shouldThrow();
244 <        }
251 <        catch (NullPointerException success) {}
244 >        } catch (NullPointerException success) {}
245      }
246  
247      /**
# Line 545 | Line 538 | public class TreeSetTest extends JSR166T
538      /**
539       * A deserialized serialized set has same elements
540       */
541 <    public void testSerialization() {
541 >    public void testSerialization() throws Exception {
542          TreeSet q = populatedSet(SIZE);
543 <        try {
544 <            ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
545 <            ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
546 <            out.writeObject(q);
547 <            out.close();
548 <
549 <            ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
550 <            ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
551 <            TreeSet r = (TreeSet)in.readObject();
552 <            assertEquals(q.size(), r.size());
553 <            while (!q.isEmpty())
561 <                assertEquals(q.pollFirst(), r.pollFirst());
562 <        } catch (Exception e) {
563 <            e.printStackTrace();
564 <            unexpectedException();
565 <        }
543 >        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
544 >        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
545 >        out.writeObject(q);
546 >        out.close();
547 >
548 >        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
549 >        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
550 >        TreeSet r = (TreeSet)in.readObject();
551 >        assertEquals(q.size(), r.size());
552 >        while (!q.isEmpty())
553 >            assertEquals(q.pollFirst(), r.pollFirst());
554      }
555  
556      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines