--- jsr166/src/test/tck/TreeSetTest.java 2009/11/21 02:07:27 1.7 +++ jsr166/src/test/tck/TreeSetTest.java 2009/11/21 10:25:05 1.8 @@ -77,8 +77,7 @@ public class TreeSetTest extends JSR166T try { TreeSet q = new TreeSet((Collection)null); shouldThrow(); - } - catch (NullPointerException success) {} + } catch (NullPointerException success) {} } /** @@ -89,8 +88,7 @@ public class TreeSetTest extends JSR166T Integer[] ints = new Integer[SIZE]; TreeSet q = new TreeSet(Arrays.asList(ints)); shouldThrow(); - } - catch (NullPointerException success) {} + } catch (NullPointerException success) {} } /** @@ -103,8 +101,7 @@ public class TreeSetTest extends JSR166T ints[i] = new Integer(i); TreeSet q = new TreeSet(Arrays.asList(ints)); shouldThrow(); - } - catch (NullPointerException success) {} + } catch (NullPointerException success) {} } /** @@ -177,7 +174,7 @@ public class TreeSetTest extends JSR166T TreeSet q = populatedSet(SIZE); q.add(null); shouldThrow(); - } catch (NullPointerException success) { } + } catch (NullPointerException success) {} } /** @@ -208,8 +205,7 @@ public class TreeSetTest extends JSR166T q.add(new Object()); q.add(new Object()); shouldThrow(); - } - catch (ClassCastException success) {} + } catch (ClassCastException success) {} } /** @@ -220,8 +216,7 @@ public class TreeSetTest extends JSR166T TreeSet q = new TreeSet(); q.addAll(null); shouldThrow(); - } - catch (NullPointerException success) {} + } catch (NullPointerException success) {} } /** * addAll of a collection with null elements throws NPE @@ -232,8 +227,7 @@ public class TreeSetTest extends JSR166T Integer[] ints = new Integer[SIZE]; q.addAll(Arrays.asList(ints)); shouldThrow(); - } - catch (NullPointerException success) {} + } catch (NullPointerException success) {} } /** * addAll of a collection with any null elements throws NPE after @@ -247,8 +241,7 @@ public class TreeSetTest extends JSR166T ints[i] = new Integer(i); q.addAll(Arrays.asList(ints)); shouldThrow(); - } - catch (NullPointerException success) {} + } catch (NullPointerException success) {} } /** @@ -545,24 +538,19 @@ public class TreeSetTest extends JSR166T /** * A deserialized serialized set has same elements */ - public void testSerialization() { + public void testSerialization() throws Exception { TreeSet q = populatedSet(SIZE); - try { - ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); - ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); - out.writeObject(q); - out.close(); - - ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); - ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); - TreeSet r = (TreeSet)in.readObject(); - assertEquals(q.size(), r.size()); - while (!q.isEmpty()) - assertEquals(q.pollFirst(), r.pollFirst()); - } catch (Exception e) { - e.printStackTrace(); - unexpectedException(); - } + ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); + ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); + out.writeObject(q); + out.close(); + + ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); + ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); + TreeSet r = (TreeSet)in.readObject(); + assertEquals(q.size(), r.size()); + while (!q.isEmpty()) + assertEquals(q.pollFirst(), r.pollFirst()); } /**