559 |
|
/** |
560 |
|
* A deserialized map equals original |
561 |
|
*/ |
562 |
< |
public void testSerialization() { |
562 |
> |
public void testSerialization() throws Exception { |
563 |
|
ConcurrentHashMap q = map5(); |
564 |
|
|
565 |
< |
try { |
566 |
< |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
567 |
< |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
568 |
< |
out.writeObject(q); |
569 |
< |
out.close(); |
565 |
> |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
566 |
> |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
567 |
> |
out.writeObject(q); |
568 |
> |
out.close(); |
569 |
|
|
570 |
< |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
571 |
< |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
572 |
< |
ConcurrentHashMap r = (ConcurrentHashMap)in.readObject(); |
573 |
< |
assertEquals(q.size(), r.size()); |
574 |
< |
assertTrue(q.equals(r)); |
575 |
< |
assertTrue(r.equals(q)); |
577 |
< |
} catch (Exception e) { |
578 |
< |
e.printStackTrace(); |
579 |
< |
unexpectedException(); |
580 |
< |
} |
570 |
> |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
571 |
> |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
572 |
> |
ConcurrentHashMap r = (ConcurrentHashMap)in.readObject(); |
573 |
> |
assertEquals(q.size(), r.size()); |
574 |
> |
assertTrue(q.equals(r)); |
575 |
> |
assertTrue(r.equals(q)); |
576 |
|
} |
577 |
|
|
578 |
|
|