|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectpatterntesting.runtime.junit.SerializableTester
public final class SerializableTester
This is a utility class to check the serializable nature of classes.
NOTE: In the future this class will be perhaps part of the ObjectTester
class.
Before v1.1 the methods are named "checkSerialization". Since 1.1 these
methods will have now an "assert" prefix ("assertSerialization").
| Method Summary | |
|---|---|
static void |
assertSerialization(Class<? extends Serializable> clazz)
This method will create an object of the given class using the default constructor. |
static void |
assertSerialization(Collection<Class<Serializable>> classes)
Check for each class in the given collection if it can be serialized and deserialized. |
static void |
assertSerialization(Package pkg)
Check for each class in the given package if it can be serialized and deserialized. |
static void |
assertSerialization(Serializable object)
Check serialization and deserialization of an object. |
static void |
assertSerializationOfPackage(String packageName)
Check for each class in the given package if it can be serialized and deserialized. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void assertSerialization(Serializable object)
throws NotSerializableException
object - the object
NotSerializableException - if object can't serialized
public static void assertSerialization(Class<? extends Serializable> clazz)
throws NotSerializableException
clazz - the clazz
NotSerializableException - if the check fails
public static void assertSerialization(Collection<Class<Serializable>> classes)
throws NotSerializableException
classes - a collection of classes to be checked
NotSerializableException - if one of the classes can't be serialized
public static void assertSerialization(Package pkg)
throws NotSerializableException
Package.getPackage(String).
But be sure that you can't get null as result. In this case
use assertSerializationOfPackage(String).
pkg - the package e.g. "patterntesting.runtime"
NotSerializableException - if one of the class can't be serializedassertSerializationOfPackage(String)
public static void assertSerializationOfPackage(String packageName)
throws NotSerializableException
packageName - the package name e.g. "patterntesting.runtime"
NotSerializableException - if one of the class can't be serialized
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||