org.jtiger.assertion
Class Serialization

java.lang.Object
  extended by org.jtiger.assertion.Serialization

public final class Serialization
extends Object

Provides the ability to make assertions regarding the serializability of objects.

Version:
2.1
Build Number 0376
Build Time 2006-07-28 01:50.16.218 CET (GMT + 1)
Author:
Tony Morris
See Also:
Serializable

Method Summary
static void assertNotSerializes(Serializable s, Object... message)
          Asserts that the given Serializable instance does not successfully (without exceptions) serialize and deserialize.
static void assertSerializes(Serializable s, Object... message)
          Asserts that the given Serializable instance successfully (without exceptions) serializes and deserializes.
static void assertSerializesEqual(Serializable s, Object... message)
          Asserts that the given Serializable instance serializes and deserializes to produce an instance that is equal according to its equals method implementation.
static void assertSerializesSame(Serializable s, Object... message)
          Asserts that the given Serializable instance serializes and deserializes to produce the same instance.
static void assertSerializesUnequal(Serializable s, Object... message)
          Asserts that the given Serializable instance serializes and deserializes to produce an instance that is unequal according to its equals method implementation.
static void assertSerializesUnsame(Serializable s, Object... message)
          Asserts that the given Serializable instance serializes and deserializes to produce a new instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assertSerializes

public static void assertSerializes(Serializable s,
                                    Object... message)
                             throws AssertionException
Asserts that the given Serializable instance successfully (without exceptions) serializes and deserializes.

Parameters:
s - The Serializable instance to make the assertion on.
message - The assertion message.
Throws:
AssertionException - If the given Serializable instance does not successfully (without exceptions) serialize and deserialize.

assertNotSerializes

public static void assertNotSerializes(Serializable s,
                                       Object... message)
                                throws AssertionException
Asserts that the given Serializable instance does not successfully (without exceptions) serialize and deserialize.

Parameters:
s - The Serializable instance to make the assertion on.
message - The assertion message.
Throws:
AssertionException - If the given Serializable instance successfully (without exceptions) serializes and deserializes.

assertSerializesSame

public static void assertSerializesSame(Serializable s,
                                        Object... message)
                                 throws AssertionException
Asserts that the given Serializable instance serializes and deserializes to produce the same instance. This can only be achieved by overriding the readResolve method.

Parameters:
s - The Serializable instance to make the assertion on.
message - The assertion message.
Throws:
AssertionException - If the given Serializable instance does not serialize and deserialize to produce the same instance.

assertSerializesUnsame

public static void assertSerializesUnsame(Serializable s,
                                          Object... message)
                                   throws AssertionException
Asserts that the given Serializable instance serializes and deserializes to produce a new instance.

Parameters:
s - The Serializable instance to make the assertion on.
message - The assertion message.
Throws:
AssertionException - If the given Serializable instance does not serialize and deserialize to produce a new instance.

assertSerializesEqual

public static void assertSerializesEqual(Serializable s,
                                         Object... message)
                                  throws AssertionException
Asserts that the given Serializable instance serializes and deserializes to produce an instance that is equal according to its equals method implementation.

Parameters:
s - The Serializable instance to make the assertion on.
message - The assertion message.
Throws:
AssertionException - If the given Serializable instance does not serialize and deserialize to produce an instance that is equal according to its equals method implementation.
See Also:
Object.equals(Object)

assertSerializesUnequal

public static void assertSerializesUnequal(Serializable s,
                                           Object... message)
                                    throws AssertionException
Asserts that the given Serializable instance serializes and deserializes to produce an instance that is unequal according to its equals method implementation.

Parameters:
s - The Serializable instance to make the assertion on.
message - The assertion message.
Throws:
AssertionException - If the given Serializable instance does not serialize and deserialize to produce an instance that is unequal according to its equals method implementation.
See Also:
Object.equals(Object)