checked serialization of DefaultTransformer and added a test for it
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@795975 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d7f7b629b8
commit
77b5519151
|
@ -30,8 +30,6 @@ import org.apache.commons.math.MathException;
|
||||||
* @version $Revision$ $Date$
|
* @version $Revision$ $Date$
|
||||||
*/
|
*/
|
||||||
public class DefaultTransformer implements NumberTransformer, Serializable {
|
public class DefaultTransformer implements NumberTransformer, Serializable {
|
||||||
// TODO: Add Serializable documentation
|
|
||||||
// TODO: Check Serializable implementation
|
|
||||||
|
|
||||||
/** Serializable version identifier */
|
/** Serializable version identifier */
|
||||||
private static final long serialVersionUID = 4019938025047800455L;
|
private static final long serialVersionUID = 4019938025047800455L;
|
||||||
|
@ -60,4 +58,23 @@ public class DefaultTransformer implements NumberTransformer, Serializable {
|
||||||
"Conversion Exception in Transformation: {0}", e.getMessage());
|
"Conversion Exception in Transformation: {0}", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (this == other) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (other == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return other instanceof DefaultTransformer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
// some arbitrary number ...
|
||||||
|
return 401993047;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,11 @@ package org.apache.commons.math.util;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import org.apache.commons.math.MathException;
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.apache.commons.math.MathException;
|
||||||
|
import org.apache.commons.math.TestUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version $Revision$ $Date$
|
* @version $Revision$ $Date$
|
||||||
*/
|
*/
|
||||||
|
@ -92,4 +94,9 @@ public class DefaultTransformerTest extends TestCase {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSerial() {
|
||||||
|
assertEquals(new DefaultTransformer(), TestUtils.serializeAndRecover(new DefaultTransformer()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue