org.infinitest.toolkit
Class StrictCloneabilityTestSupport<T extends Cloneable>

java.lang.Object
  extended by org.infinitest.toolkit.StrictCloneabilityTestSupport<T>

public abstract class StrictCloneabilityTestSupport<T extends Cloneable>
extends Object

Support structure for testing the cloneability of instances of a class. The contract for Object.clone() is fairly lax, but this class tests that after a clone operation, the original and the clone references refer to instances of the same class, and are not the same, and compare equal, and whose respective reference fields do not refer to the same objects. For reference fields that are arrays, Lists, or Maps, tests also that each element of the original collection does not refer to the same object as the corresponding slot in the clone (values only for maps, since keys of maps should be immutable).

Author:
Paul Holser

Constructor Summary
StrictCloneabilityTestSupport()
           
 
Method Summary
 void copyShouldBeEquivalentToOriginal()
           
 void copyShouldBeOfSameClassAsOriginal()
           
 void copyShouldHaveObjectFieldsWhichAreNotSameAsOriginal()
           
 void copyShouldNotBeIdenticalToOriginal()
           
 void initializeHarness()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StrictCloneabilityTestSupport

public StrictCloneabilityTestSupport()
Method Detail

initializeHarness

public final void initializeHarness()
                             throws Exception
Throws:
Exception

copyShouldBeOfSameClassAsOriginal

public final void copyShouldBeOfSameClassAsOriginal()

copyShouldNotBeIdenticalToOriginal

public final void copyShouldNotBeIdenticalToOriginal()

copyShouldBeEquivalentToOriginal

public final void copyShouldBeEquivalentToOriginal()

copyShouldHaveObjectFieldsWhichAreNotSameAsOriginal

public final void copyShouldHaveObjectFieldsWhichAreNotSameAsOriginal()
                                                               throws Exception
Throws:
Exception


© Copyright 2009 Paul R. Holser, Jr. All rights reserved. pholser@alumni.rice.edu