de.smartics.util.test.theories
Class SerializationTheory
java.lang.Object
de.smartics.util.test.theories.SerializationTheory
-
public abstract class SerializationTheory
-
extends
Object
Test theory on serializing serializable instances. If instances are defined as data points that are not serializable, the test leads to a test error.
-
Author:
-
Robert Reiner
Method Summary |
protected boolean |
checkThatResultEquals() Determines whether or not the theory should check the serialized and deserialized instance on equality with the original instance. |
void |
isSerializable(Object uut) Checks that the unit under test (UUT) is serializable. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SerializationTheory
public SerializationTheory()
checkThatResultEquals
protected boolean checkThatResultEquals()
-
Determines whether or not the theory should check the serialized and deserialized instance on equality with the original instance. If the unit under test (UUT) does not provide an implementation of
Object.equals(Object)
, this method must return
false
.
Override this method by your subclass.
-
-
Returns:
-
false
per default.
isSerializable
public final void isSerializable(Object uut)
throws IOException,
ClassNotFoundException
-
Checks that the unit under test (UUT) is serializable.
-
-
Parameters:
-
uut
- the unit under test. It is required for the instance to implement the equals method, if
checkThatResultEquals()
returns
true
If that method returns
false
this test only checks that the serialization process throws no exception.
-
Throws:
-
ClassNotFoundException
- if the class cannot be found during deserialization.
-
IOException
- on any problem writing the instance to or reading it from the stream.
-
See Also:
-
Serializable
,
Externizable
Copyright © 2008-2012
Kronseder & Reiner GmbH - smartics. All Rights Reserved.