public abstract class SerializabilityTestCase
extends junit.framework.TestCase
createInstance
methods to
provide me with an object to test against. The object's class must
implement Serializable
.Serializable
Constructor and Description |
---|
SerializabilityTestCase(java.lang.String name)
Creates a new test.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkThawedObject(java.io.Serializable expected,
java.io.Serializable actual)
Template method--override this to perform checks on the deserialized
form of the object serialized in
testSerializability() . |
protected abstract java.io.Serializable |
createInstance()
Creates and returns an instance of the class under test.
|
protected void |
setUp()
Sets up the test fixture.
|
void |
testSerializability()
Verifies that an instance of the class under test can be serialized and
deserialized without error.
|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, tearDown, toString
public SerializabilityTestCase(java.lang.String name)
name
- name of the testprotected abstract java.io.Serializable createInstance() throws java.lang.Exception
java.lang.Exception
protected void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
public final void testSerializability() throws java.lang.Exception
java.lang.Exception
protected void checkThawedObject(java.io.Serializable expected, java.io.Serializable actual) throws java.lang.Exception
testSerializability()
. If not
overridden, this asserts that the pre-serialization and deserialized
forms of the object compare equal via
equals
.expected
- the pre-serialization form of the objectactual
- the deserialized form of the objectjava.lang.Exception
Copyright © ${project.year} ${project.holder}. All Rights Reserved.