--- jsr166/src/test/tck/TreeSubMapTest.java 2011/05/27 19:10:32 1.15 +++ jsr166/src/test/tck/TreeSubMapTest.java 2011/05/31 16:16:24 1.16 @@ -6,8 +6,6 @@ import junit.framework.*; import java.util.*; -import java.util.concurrent.*; -import java.io.*; public class TreeSubMapTest extends JSR166TestCase { public static void main(String[] args) { @@ -72,7 +70,6 @@ public class TreeSubMapTest extends JSR1 assertEquals(map.size(), 0); } - /** * Maps with same contents are equal */ @@ -141,7 +138,6 @@ public class TreeSubMapTest extends JSR1 assertEquals(five, map.lastKey()); } - /** * keySet returns a Set containing all the keys */ @@ -430,24 +426,16 @@ public class TreeSubMapTest extends JSR1 * A deserialized map equals original */ public void testSerialization() throws Exception { - NavigableMap q = map5(); + NavigableMap x = map5(); + NavigableMap y = serialClone(x); - ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); - ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); - out.writeObject(q); - out.close(); - - ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); - ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); - NavigableMap r = (NavigableMap)in.readObject(); - assertFalse(r.isEmpty()); - assertEquals(q.size(), r.size()); - assertTrue(q.equals(r)); - assertTrue(r.equals(q)); + assertTrue(x != y); + assertEquals(x.size(), y.size()); + assertEquals(x.toString(), y.toString()); + assertEquals(x, y); + assertEquals(y, x); } - - /** * subMap returns map with keys in requested range */ @@ -592,7 +580,6 @@ public class TreeSubMapTest extends JSR1 assertEquals(map.size(), 0); } - /** * Maps with same contents are equal */ @@ -661,7 +648,6 @@ public class TreeSubMapTest extends JSR1 assertEquals(m5, map.lastKey()); } - /** * keySet returns a Set containing all the keys */ @@ -748,7 +734,6 @@ public class TreeSubMapTest extends JSR1 assertTrue(s.contains("E")); } - /** * entrySet contains all pairs */ @@ -783,7 +768,6 @@ public class TreeSubMapTest extends JSR1 assertTrue(empty.containsKey(m5)); } - /** * remove removes the correct key-value pair from the map */ @@ -969,22 +953,16 @@ public class TreeSubMapTest extends JSR1 * A deserialized map equals original */ public void testDescendingSerialization() throws Exception { - NavigableMap q = dmap5(); + NavigableMap x = dmap5(); + NavigableMap y = serialClone(x); - ByteArrayOutputStream bout = new ByteArrayOutputStream(10000); - ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout)); - out.writeObject(q); - out.close(); - - ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray()); - ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); - NavigableMap r = (NavigableMap)in.readObject(); - assertEquals(q.size(), r.size()); - assertTrue(q.equals(r)); - assertTrue(r.equals(q)); + assertTrue(x != y); + assertEquals(x.size(), y.size()); + assertEquals(x.toString(), y.toString()); + assertEquals(x, y); + assertEquals(y, x); } - /** * subMap returns map with keys in requested range */