<action issue="LANG-962" type="add" dev="ggregory">Add SerializationUtils.roundtrip(T extends Serializable) to serialize then deserialize</action>
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1563309 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
364d5912b2
commit
a3de60835e
|
@ -22,6 +22,7 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<release version="3.3" date="TBA" description="Bugfix and Feature release">
|
<release version="3.3" date="TBA" description="Bugfix and Feature release">
|
||||||
|
<action issue="LANG-962" type="add" dev="ggregory">Add SerializationUtils.roundtrip(T extends Serializable) to serialize then deserialize</action>
|
||||||
<action issue="LANG-341" type="add" due-to="Vincent Ricard" dev="djones">Please add number to byte[] methods</action>
|
<action issue="LANG-341" type="add" due-to="Vincent Ricard" dev="djones">Please add number to byte[] methods</action>
|
||||||
<action issue="LANG-961" type="update" dev="ggregory">org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field) does not clean up after itself</action>
|
<action issue="LANG-961" type="update" dev="ggregory">org.apache.commons.lang3.reflect.FieldUtils.removeFinalModifier(Field) does not clean up after itself</action>
|
||||||
<action issue="LANG-958" type="update" dev="chas">FastDateParser javadoc incorrectly states that SimpleDateFormat is used internally</action>
|
<action issue="LANG-958" type="update" dev="chas">FastDateParser javadoc incorrectly states that SimpleDateFormat is used internally</action>
|
||||||
|
|
|
@ -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 extends Serializable> T roundtrip(final T msg) {
|
||||||
|
return SerializationUtils.deserialize(SerializationUtils.serialize(msg));
|
||||||
|
}
|
||||||
|
|
||||||
// Serialize
|
// Serialize
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -271,6 +271,12 @@ public class SerializationUtilsTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRoundtrip() {
|
||||||
|
HashMap<Object, Object> newMap = SerializationUtils.roundtrip(iMap);
|
||||||
|
assertEquals(iMap, newMap);
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue