Package dk.netarkivet.testutils
Class Serial
- java.lang.Object
-
- dk.netarkivet.testutils.Serial
-
public class Serial extends Object
Created by IntelliJ IDEA. User: csr Date: Mar 4, 2005 Time: 2:26:06 PM To change this template use File | Settings | File Templates.
-
-
Constructor Summary
Constructors Constructor Description Serial()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends Serializable>
voidassertTransientFieldsInitialized(T obj, String... excludedFields)
Check that transient fields are properly initialized after the object has been serialized and deserialized.static <T extends Serializable>
Tserial(T input_object)
Serializes an Object, deserializes it, and then returns it.
-
-
-
Method Detail
-
serial
public static <T extends Serializable> T serial(T input_object) throws IOException, ClassNotFoundException
Serializes an Object, deserializes it, and then returns it.- Parameters:
input_object
-- Returns:
- Object
- Throws:
IOException
ClassNotFoundException
-
assertTransientFieldsInitialized
public static <T extends Serializable> void assertTransientFieldsInitialized(T obj, String... excludedFields) throws IOException, ClassNotFoundException, IllegalAccessException
Check that transient fields are properly initialized after the object has been serialized and deserialized.- Parameters:
obj
- A Serializable object to test.excludedFields
- Names of fields that we do not care are not initialized after deserialization. Could be integers that are properly initialized to 0 or the like. Only include fields here if you are sure that initialization is not required!- Throws:
IOException
ClassNotFoundException
IllegalAccessException
-
-