|
JUnit-addons version 1.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.framework.Assert | +--junit.framework.TestCase | +--junitx.extensions.SerializabilityTestCase
Extend me in order to test the serializability of a class. Override my
createInstance
methods to
provide me with an object to test against. The object's class must
implement Serializable
.
Serializable
Constructor Summary | |
SerializabilityTestCase(java.lang.String name)
Creates a new test. |
Method Summary | |
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. |
Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, tearDown, toString |
Methods inherited from class junit.framework.Assert |
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SerializabilityTestCase(java.lang.String name)
name
- name of the testMethod Detail |
protected 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 object
java.lang.Exception
|
JUnit-addons version 1.4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |