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

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

# Line 72 | Line 72 | public class ConcurrentSkipListSetTest e
72          try {
73              ConcurrentSkipListSet q = new ConcurrentSkipListSet((Collection)null);
74              shouldThrow();
75 <        }
76 <        catch (NullPointerException success) {}
75 >        } catch (NullPointerException success) {}
76      }
77  
78      /**
# Line 84 | Line 83 | public class ConcurrentSkipListSetTest e
83              Integer[] ints = new Integer[SIZE];
84              ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints));
85              shouldThrow();
86 <        }
88 <        catch (NullPointerException success) {}
86 >        } catch (NullPointerException success) {}
87      }
88  
89      /**
# Line 98 | Line 96 | public class ConcurrentSkipListSetTest e
96                  ints[i] = new Integer(i);
97              ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints));
98              shouldThrow();
99 <        }
102 <        catch (NullPointerException success) {}
99 >        } catch (NullPointerException success) {}
100      }
101  
102      /**
103       * Set contains all elements of collection used to initialize
104       */
105      public void testConstructor6() {
106 <        try {
107 <            Integer[] ints = new Integer[SIZE];
108 <            for (int i = 0; i < SIZE; ++i)
109 <                ints[i] = new Integer(i);
110 <            ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints));
111 <            for (int i = 0; i < SIZE; ++i)
115 <                assertEquals(ints[i], q.pollFirst());
116 <        }
117 <        finally {}
106 >        Integer[] ints = new Integer[SIZE];
107 >        for (int i = 0; i < SIZE; ++i)
108 >            ints[i] = new Integer(i);
109 >        ConcurrentSkipListSet q = new ConcurrentSkipListSet(Arrays.asList(ints));
110 >        for (int i = 0; i < SIZE; ++i)
111 >            assertEquals(ints[i], q.pollFirst());
112      }
113  
114      /**
# Line 172 | Line 166 | public class ConcurrentSkipListSetTest e
166              ConcurrentSkipListSet q = new ConcurrentSkipListSet();
167              q.add(null);
168              shouldThrow();
169 <        } catch (NullPointerException success) { }
169 >        } catch (NullPointerException success) {}
170      }
171  
172      /**
# Line 203 | Line 197 | public class ConcurrentSkipListSetTest e
197              q.add(new Object());
198              q.add(new Object());
199              shouldThrow();
200 <        }
207 <        catch (ClassCastException success) {}
200 >        } catch (ClassCastException success) {}
201      }
202  
203      /**
# Line 215 | Line 208 | public class ConcurrentSkipListSetTest e
208              ConcurrentSkipListSet q = new ConcurrentSkipListSet();
209              q.addAll(null);
210              shouldThrow();
211 <        }
219 <        catch (NullPointerException success) {}
211 >        } catch (NullPointerException success) {}
212      }
213      /**
214       * addAll of a collection with null elements throws NPE
# Line 227 | Line 219 | public class ConcurrentSkipListSetTest e
219              Integer[] ints = new Integer[SIZE];
220              q.addAll(Arrays.asList(ints));
221              shouldThrow();
222 <        }
231 <        catch (NullPointerException success) {}
222 >        } catch (NullPointerException success) {}
223      }
224      /**
225       * addAll of a collection with any null elements throws NPE after
# Line 242 | Line 233 | public class ConcurrentSkipListSetTest e
233                  ints[i] = new Integer(i);
234              q.addAll(Arrays.asList(ints));
235              shouldThrow();
236 <        }
246 <        catch (NullPointerException success) {}
236 >        } catch (NullPointerException success) {}
237      }
238  
239      /**
# Line 540 | Line 530 | public class ConcurrentSkipListSetTest e
530      /**
531       * A deserialized serialized set has same elements
532       */
533 <    public void testSerialization() {
533 >    public void testSerialization() throws Exception {
534          ConcurrentSkipListSet q = populatedSet(SIZE);
535 <        try {
536 <            ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
537 <            ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
538 <            out.writeObject(q);
539 <            out.close();
540 <
541 <            ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
542 <            ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
543 <            ConcurrentSkipListSet r = (ConcurrentSkipListSet)in.readObject();
544 <            assertEquals(q.size(), r.size());
545 <            while (!q.isEmpty())
556 <                assertEquals(q.pollFirst(), r.pollFirst());
557 <        } catch (Exception e) {
558 <            e.printStackTrace();
559 <            unexpectedException();
560 <        }
535 >        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
536 >        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
537 >        out.writeObject(q);
538 >        out.close();
539 >
540 >        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
541 >        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
542 >        ConcurrentSkipListSet r = (ConcurrentSkipListSet)in.readObject();
543 >        assertEquals(q.size(), r.size());
544 >        while (!q.isEmpty())
545 >            assertEquals(q.pollFirst(), r.pollFirst());
546      }
547  
548      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines