Added method to verify that serialization / deserialization preserves equals and hashCode (when this is supported).

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/math/trunk@141302 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2004-06-17 21:41:56 +00:00
parent a749d017bf
commit 1d37fc5fd5
1 changed files with 12 additions and 1 deletions

View File

@ -27,7 +27,7 @@ import junit.framework.Assert;
import org.apache.commons.math.complex.Complex;
/**
* @version $Revision: 1.13 $ $Date: 2004/05/05 19:55:14 $
* @version $Revision: 1.14 $ $Date: 2004/06/17 21:41:56 $
*/
public class TestUtils {
/**
@ -97,4 +97,15 @@ public class TestUtils {
return result;
}
/**
* Verifies that serialization preserves equals and hashCode
*
* @param object
*/
public static void checkSerializedEquality(Object object) {
Object object2 = serializeAndRecover(object);
Assert.assertEquals("Equals check", object, object2);
Assert.assertEquals("HashCode check", object.hashCode(), object2.hashCode());
}
}