diff --git a/src/test/org/apache/commons/collections/map/AbstractTestMap.java b/src/test/org/apache/commons/collections/map/AbstractTestMap.java index 0ce5b5fd5..2b129c917 100644 --- a/src/test/org/apache/commons/collections/map/AbstractTestMap.java +++ b/src/test/org/apache/commons/collections/map/AbstractTestMap.java @@ -15,7 +15,6 @@ */ package org.apache.commons.collections.map; -import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; @@ -118,7 +117,7 @@ import org.apache.commons.collections.set.AbstractTestSet; * @author Rodney Waldhoff * @author Paul Jack * @author Stephen Colebourne - * @version $Revision: 1.9 $ $Date: 2004/04/01 22:18:12 $ + * @version $Revision: 1.10 $ $Date: 2004/04/09 09:38:31 $ */ public abstract class AbstractTestMap extends AbstractTestObject { @@ -718,7 +717,7 @@ public abstract class AbstractTestMap extends AbstractTestObject { * Compare the current serialized form of the Map * against the canonical version in CVS. */ - public void testEmptyMapCompatibility() throws IOException, ClassNotFoundException { + public void testEmptyMapCompatibility() throws Exception { /** * Create canonical objects with this code Map map = makeEmptyMap(); @@ -739,7 +738,7 @@ public abstract class AbstractTestMap extends AbstractTestObject { * Compare the current serialized form of the Map * against the canonical version in CVS. */ - public void testFullMapCompatibility() throws IOException, ClassNotFoundException { + public void testFullMapCompatibility() throws Exception { /** * Create canonical objects with this code Map map = makeFullMap(); diff --git a/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java b/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java index da92e3aad..a2f28c236 100644 --- a/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java +++ b/src/test/org/apache/commons/collections/map/AbstractTestSortedMap.java @@ -28,7 +28,7 @@ import org.apache.commons.collections.BulkTest; /** * Abstract test class for {@link java.util.SortedMap} methods and contracts. * - * @version $Revision: 1.5 $ $Date: 2004/04/02 23:09:09 $ + * @version $Revision: 1.6 $ $Date: 2004/04/09 09:38:31 $ * * @author Stephen Colebourne */ @@ -44,6 +44,17 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap { } //----------------------------------------------------------------------- + /** + * Returns whether the sub map views are serializable. + * If the class being tested is based around a TreeMap then you should + * override and return false as TreeMap has a bug in deserialization. + * + * @return false + */ + public boolean isSubMapViewsSerializable() { + return true; + } + /** * Can't sort null keys. * @@ -161,6 +172,18 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap { public boolean supportsFullCollections() { return false; } + public void testSerializeDeserializeThenCompare() throws Exception { + if (((AbstractTestSortedMap) main).isSubMapViewsSerializable() == false) return; + super.testSerializeDeserializeThenCompare(); + } + public void testEmptyMapCompatibility() throws Exception { + if (((AbstractTestSortedMap) main).isSubMapViewsSerializable() == false) return; + super.testEmptyMapCompatibility(); + } + public void testFullMapCompatibility() throws Exception { + if (((AbstractTestSortedMap) main).isSubMapViewsSerializable() == false) return; + super.testFullMapCompatibility(); + } } public static class TestHeadMap extends TestViewMap { @@ -313,11 +336,11 @@ public abstract class AbstractTestSortedMap extends AbstractTestMap { // Map map = makeEmptyMap(); // writeExternalFormToDisk( // (java.io.Serializable) map, -// "D:/dev/collections/data/test/FixedSizeSortedMap.emptyCollection.version3.1.SubMapView.obj"); +// "D:/dev/collections/data/test/TransformedSortedMap.emptyCollection.version3.1.SubMapView.obj"); // map = makeFullMap(); // writeExternalFormToDisk( // (java.io.Serializable) map, -// "D:/dev/collections/data/test/FixedSizeSortedMap.fullCollection.version3.1.SubMapView.obj"); +// "D:/dev/collections/data/test/TransformedSortedMap.fullCollection.version3.1.SubMapView.obj"); // } }