435 |
|
/** |
436 |
|
* A deserialized map equals original |
437 |
|
*/ |
438 |
< |
public void testSerialization() { |
438 |
> |
public void testSerialization() throws Exception { |
439 |
|
NavigableMap q = map5(); |
440 |
|
|
441 |
< |
try { |
442 |
< |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
443 |
< |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
444 |
< |
out.writeObject(q); |
445 |
< |
out.close(); |
446 |
< |
|
447 |
< |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
448 |
< |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
449 |
< |
NavigableMap r = (NavigableMap)in.readObject(); |
450 |
< |
assertFalse(r.isEmpty()); |
451 |
< |
assertEquals(q.size(), r.size()); |
452 |
< |
assertTrue(q.equals(r)); |
453 |
< |
assertTrue(r.equals(q)); |
454 |
< |
} catch (Exception e) { |
455 |
< |
e.printStackTrace(); |
456 |
< |
unexpectedException(); |
457 |
< |
} |
441 |
> |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
442 |
> |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
443 |
> |
out.writeObject(q); |
444 |
> |
out.close(); |
445 |
> |
|
446 |
> |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
447 |
> |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
448 |
> |
NavigableMap r = (NavigableMap)in.readObject(); |
449 |
> |
assertFalse(r.isEmpty()); |
450 |
> |
assertEquals(q.size(), r.size()); |
451 |
> |
assertTrue(q.equals(r)); |
452 |
> |
assertTrue(r.equals(q)); |
453 |
|
} |
454 |
|
|
455 |
|
|
980 |
|
/** |
981 |
|
* A deserialized map equals original |
982 |
|
*/ |
983 |
< |
public void testDescendingSerialization() { |
983 |
> |
public void testDescendingSerialization() throws Exception { |
984 |
|
NavigableMap q = dmap5(); |
985 |
|
|
986 |
< |
try { |
987 |
< |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
988 |
< |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
989 |
< |
out.writeObject(q); |
990 |
< |
out.close(); |
991 |
< |
|
992 |
< |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
993 |
< |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
994 |
< |
NavigableMap r = (NavigableMap)in.readObject(); |
995 |
< |
assertEquals(q.size(), r.size()); |
996 |
< |
assertTrue(q.equals(r)); |
1002 |
< |
assertTrue(r.equals(q)); |
1003 |
< |
} catch (Exception e) { |
1004 |
< |
e.printStackTrace(); |
1005 |
< |
unexpectedException(); |
1006 |
< |
} |
986 |
> |
ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); |
987 |
> |
ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); |
988 |
> |
out.writeObject(q); |
989 |
> |
out.close(); |
990 |
> |
|
991 |
> |
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); |
992 |
> |
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
993 |
> |
NavigableMap r = (NavigableMap)in.readObject(); |
994 |
> |
assertEquals(q.size(), r.size()); |
995 |
> |
assertTrue(q.equals(r)); |
996 |
> |
assertTrue(r.equals(q)); |
997 |
|
} |
998 |
|
|
999 |
|
|
1010 |
– |
|
1000 |
|
/** |
1001 |
|
* subMap returns map with keys in requested range |
1002 |
|
*/ |