public class SerializationTestHelper extends Object
Modifier and Type | Method and Description |
---|---|
static void |
assertSerializationEquals(String witness,
Object obj,
int[] skip,
int endCompare)
Checks the serialization of an object against an file
containing the expected serialization.
|
static void |
assertStreamEquals(String witness,
byte[] actual,
int[] skip,
int endCompare)
Asserts the serialized form of an object.
|
static Object |
deserializeStream(String witness)
Deserializes a specified file.
|
static Object |
serializeClone(Object obj)
Creates a clone by serializing object and
deserializing byte stream.
|
public static Object serializeClone(Object obj) throws IOException, ClassNotFoundException
obj
- object to serialize and deserialize.IOException
- on IO error.ClassNotFoundException
- if class not found.public static Object deserializeStream(String witness) throws Exception
witness
- serialization file, may not be null.Exception
- thrown on IO or deserialization exception.public static void assertSerializationEquals(String witness, Object obj, int[] skip, int endCompare) throws Exception
witness
- name of file containing expected serialization.obj
- object to be serialized.skip
- positions in serialized stream that should not be compared.endCompare
- position to stop comparison.Exception
- thrown on IO or serialization exception.public static void assertStreamEquals(String witness, byte[] actual, int[] skip, int endCompare) throws IOException
witness
- file name of expected serialization.actual
- byte array of actual serialization.skip
- positions to skip comparison.endCompare
- position to stop comparison.IOException
- thrown on IO or serialization exception.Copyright © 2013 The Apache Software Foundation. Licensed under the Apache License, Version 2.0
Apache Extras for Apache log4j, Apache log4j and Apache are trademarks of the Apache Software Foundation.