610 |
|
/** |
611 |
|
* A deserialized map equals original |
612 |
|
*/ |
613 |
< |
public void testSerialization() { |
613 |
> |
public void testSerialization() throws Exception { |
614 |
|
TreeMap q = map5(); |
615 |
|
|
616 |
< |
try { |
617 |
< |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
618 |
< |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
619 |
< |
out.writeObject(q); |
620 |
< |
out.close(); |
616 |
> |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
617 |
> |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
618 |
> |
out.writeObject(q); |
619 |
> |
out.close(); |
620 |
|
|
621 |
< |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
622 |
< |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
623 |
< |
TreeMap r = (TreeMap)in.readObject(); |
624 |
< |
assertEquals(q.size(), r.size()); |
625 |
< |
assertTrue(q.equals(r)); |
626 |
< |
assertTrue(r.equals(q)); |
628 |
< |
} catch (Exception e) { |
629 |
< |
e.printStackTrace(); |
630 |
< |
unexpectedException(); |
631 |
< |
} |
621 |
> |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
622 |
> |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
623 |
> |
TreeMap r = (TreeMap)in.readObject(); |
624 |
> |
assertEquals(q.size(), r.size()); |
625 |
> |
assertTrue(q.equals(r)); |
626 |
> |
assertTrue(r.equals(q)); |
627 |
|
} |
628 |
|
|
629 |
|
/** |