|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.id.test.AssertSerialization
public class AssertSerialization
Assert
class for serialization operations.
Note: This class is intented to be moved to a commons-test component later.
Nested Class Summary | |
---|---|
static interface |
AssertSerialization.Context
Interface for the serialization test context. |
protected static class |
AssertSerialization.SerializationTest
A test case used to test the serialization capability and the compatibility with previous versions of the type. |
Constructor Summary | |
---|---|
AssertSerialization()
|
Method Summary | |
---|---|
static java.io.Serializable |
assertSerializable(java.io.Serializable serializable)
Assert an object to be Serializable. |
static java.io.Serializable |
assertSerializable(java.io.Serializable serializable,
java.lang.Class expectedType)
Assert an object to be Serializable. |
static java.io.Serializable |
assertSerializable(java.lang.String message,
java.io.Serializable serializable)
Assert an object to be Serializable. |
static java.io.Serializable |
assertSerializable(java.lang.String message,
java.io.Serializable serializable,
java.lang.Class expectedType)
Assert an object to be Serializable. |
static junit.framework.TestSuite |
createSerializationTestSuite(AssertSerialization.Context context)
Create a TestSuite for the serializability of a type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AssertSerialization()
Method Detail |
---|
public static java.io.Serializable assertSerializable(java.io.Serializable serializable)
serializable
- object to serialize
public static java.io.Serializable assertSerializable(java.lang.String message, java.io.Serializable serializable)
message
- the error messageserializable
- object to serialize
public static java.io.Serializable assertSerializable(java.io.Serializable serializable, java.lang.Class expectedType)
serializable
- object to serializeexpectedType
- the expected type of the result
public static java.io.Serializable assertSerializable(java.lang.String message, java.io.Serializable serializable, java.lang.Class expectedType)
message
- the error messageserializable
- object to serializeexpectedType
- the expected type of the result
public static junit.framework.TestSuite createSerializationTestSuite(AssertSerialization.Context context)
TestSuite
for the serializability of a type. A caller must provide a proper
AssertSerialization.Context
, that enables the suite to test the serializability of the provided type and
ensures backward compatibility for older versions of the type. For each type version a file
is provided with the serialVersionUID
as filename in a directory named like
the type to test. If no reference file is stored in the reference DB, the test fails, but the
file is created automatically, so the next run will succeed.
context
- the test Context
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |