+ Add SerializationUtils.roundtrip(T extends Serializable) to serialize then deserializePlease add number to byte[] methodsorg.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field) does not clean up after itselfFastDateParser javadoc incorrectly states that SimpleDateFormat is used internally
diff --git a/src/main/java/org/apache/commons/lang3/SerializationUtils.java b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
index 6b4e6c415..f8429aca9 100644
--- a/src/main/java/org/apache/commons/lang3/SerializationUtils.java
+++ b/src/main/java/org/apache/commons/lang3/SerializationUtils.java
@@ -111,6 +111,18 @@ public class SerializationUtils {
}
}
+ /**
+ * Performs a serialization roundtrip. Serializes and deserializes the given object, great for testing objects that
+ * implement {@link Serializable}.
+ *
+ * @param msg
+ * the object to roundtrip
+ * @return the serialized and deseralized object
+ */
+ public static T roundtrip(final T msg) {
+ return SerializationUtils.deserialize(SerializationUtils.serialize(msg));
+ }
+
// Serialize
//-----------------------------------------------------------------------
/**
diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
index 5a0a2f6bb..8a898574f 100644
--- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java
@@ -271,6 +271,12 @@ public class SerializationUtilsTest {
}
}
+ @Test
+ public void testRoundtrip() {
+ HashMap