com.diasparsoftware.util.junit
Class ValueObjectEqualsTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended bycom.diasparsoftware.util.junit.ValueObjectEqualsTest
All Implemented Interfaces:
junit.framework.Test

public abstract class ValueObjectEqualsTest
extends junit.framework.TestCase


Constructor Summary
ValueObjectEqualsTest()
           
 
Method Summary
protected static void assertNotEquals(java.lang.Object lhs, java.lang.Object rhs)
           
protected static void assertNotEquals(java.lang.String failureMessage, java.lang.Object lhs, java.lang.Object rhs)
           
protected abstract  java.lang.Object createControlInstance()
          Creates the "control" instance of the class under test — the object against which all the others are to be compared.
protected abstract  java.lang.Object createInstanceDiffersIn(java.lang.String keyPropertyName)
          Creates and returns an instance of the class under test that differs from the control instance by having a different value for the specified key property.
protected abstract  java.util.List keyPropertyNames()
          The names of the key properties used to distinguish unequal instances of this class.
protected  void setUp()
           
 void testEqualsAgainstNewObject()
          Tests whether equals holds up against a new Object (should always be false).
 void testEqualsAgainstNull()
          Tests whether equals holds up against null.
 void testEqualsAgainstUnequalObjects()
          Tests whether equals holds up against objects that should not compare equal.
 void testEqualsIsConsistentAcrossInvocations()
          Tests whether equals is consistent.
 void testEqualsIsReflexive()
          Tests whether equals is reflexive.
 void testEqualsIsSymmetricAndTransitive()
          Tests whether equals is symmetric and transitive.
 void testHashCodeContract()
          Tests the hashCode contract.
 void testHashCodeIsConsistentAcrossInvocations()
          Tests the consistency of hashCode.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, 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

ValueObjectEqualsTest

public ValueObjectEqualsTest()
Method Detail

createControlInstance

protected abstract java.lang.Object createControlInstance()
                                                   throws java.lang.Exception
Creates the "control" instance of the class under test — the object against which all the others are to be compared.

Throws:
java.lang.Exception

createInstanceDiffersIn

protected abstract java.lang.Object createInstanceDiffersIn(java.lang.String keyPropertyName)
                                                     throws java.lang.Exception
Creates and returns an instance of the class under test that differs from the control instance by having a different value for the specified key property.

Throws:
java.lang.Exception

keyPropertyNames

protected abstract java.util.List keyPropertyNames()
The names of the key properties used to distinguish unequal instances of this class.

Returns:

setUp

protected void setUp()
              throws java.lang.Exception
Throws:
java.lang.Exception

testEqualsAgainstNewObject

public final void testEqualsAgainstNewObject()
Tests whether equals holds up against a new Object (should always be false).


testEqualsAgainstNull

public final void testEqualsAgainstNull()
Tests whether equals holds up against null.


testEqualsAgainstUnequalObjects

public final void testEqualsAgainstUnequalObjects()
Tests whether equals holds up against objects that should not compare equal.


testEqualsIsConsistentAcrossInvocations

public final void testEqualsIsConsistentAcrossInvocations()
Tests whether equals is consistent.


testEqualsIsReflexive

public final void testEqualsIsReflexive()
Tests whether equals is reflexive.


testEqualsIsSymmetricAndTransitive

public final void testEqualsIsSymmetricAndTransitive()
Tests whether equals is symmetric and transitive.


testHashCodeContract

public final void testHashCodeContract()
Tests the hashCode contract.


testHashCodeIsConsistentAcrossInvocations

public final void testHashCodeIsConsistentAcrossInvocations()
Tests the consistency of hashCode.


assertNotEquals

protected static void assertNotEquals(java.lang.Object lhs,
                                      java.lang.Object rhs)

assertNotEquals

protected static void assertNotEquals(java.lang.String failureMessage,
                                      java.lang.Object lhs,
                                      java.lang.Object rhs)


Copyright © 2003-2004 Diaspar Software Services, Inc.. All Rights Reserved.