de.smartics.util.test.theories
Class SerializationTheory

Package class diagram package SerializationTheory
java.lang.Object
  extended by 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

Constructor Summary
SerializationTheory()
           
 
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
 

Constructor Detail

SerializationTheory

public SerializationTheory()
Method Detail

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.
See Also:
Serializable, Externizable
Throws:
ClassNotFoundException - if the class cannot be found during deserialization.
IOException - on any problem writing the instance to or reading it from the stream.


Copyright © 2008-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.