189 |
|
} |
190 |
|
|
191 |
|
/** |
192 |
< |
* get returns the value at the given index |
192 |
> |
* get returns the value at the given index |
193 |
|
*/ |
194 |
|
public void testGet() { |
195 |
|
CopyOnWriteArrayList full = populatedArray(3); |
247 |
|
try { |
248 |
|
it.remove(); |
249 |
|
shouldThrow(); |
250 |
< |
} |
251 |
< |
catch (UnsupportedOperationException success) {} |
250 |
> |
} catch (UnsupportedOperationException success) {} |
251 |
|
} |
252 |
|
|
253 |
|
/** |
597 |
|
/** |
598 |
|
* a deserialized serialiszed list is equal |
599 |
|
*/ |
600 |
< |
public void testSerialization() { |
600 |
> |
public void testSerialization() throws Exception { |
601 |
|
CopyOnWriteArrayList q = populatedArray(SIZE); |
602 |
|
|
603 |
< |
try { |
604 |
< |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
605 |
< |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
606 |
< |
out.writeObject(q); |
607 |
< |
out.close(); |
608 |
< |
|
609 |
< |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
610 |
< |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
611 |
< |
CopyOnWriteArrayList r = (CopyOnWriteArrayList)in.readObject(); |
612 |
< |
assertEquals(q.size(), r.size()); |
613 |
< |
assertTrue(q.equals(r)); |
615 |
< |
assertTrue(r.equals(q)); |
616 |
< |
} catch (Exception e) { |
617 |
< |
unexpectedException(); |
618 |
< |
} |
603 |
> |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
604 |
> |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
605 |
> |
out.writeObject(q); |
606 |
> |
out.close(); |
607 |
> |
|
608 |
> |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
609 |
> |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
610 |
> |
CopyOnWriteArrayList r = (CopyOnWriteArrayList)in.readObject(); |
611 |
> |
assertEquals(q.size(), r.size()); |
612 |
> |
assertTrue(q.equals(r)); |
613 |
> |
assertTrue(r.equals(q)); |
614 |
|
} |
615 |
|
|
616 |
|
} |