org.apache.aries.unittest.junit
Class Assert

java.lang.Object
  extended by org.apache.aries.unittest.junit.Assert

public class Assert
extends Object

A library of useful assertion routines.


Constructor Summary
Assert()
           
 
Method Summary
static
<T> void
assertEqualsContract(T info, T info2, T info3)
          This method asserts that the equals contract is upheld by type T.
static
<T> void
assertHashCodeEquals(T obj, T obj2, boolean equalObjects)
          This method checks that the two objects have the same hashCode.
static
<T> void
assertHashCodeNotEquals(T obj, T obj2)
          This method makes sure that the hashCodes are not equal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Assert

public Assert()
Method Detail

assertHashCodeEquals

public static <T> void assertHashCodeEquals(T obj,
                                            T obj2,
                                            boolean equalObjects)
This method checks that the two objects have the same hashCode. If the equalsObjects parameter is true then the objects must also be .equals equal if the equalsObject parameter is false then they must not be .equals equal.

Type Parameters:
T -
Parameters:
obj - the first object.
obj2 - the second object.
equalObjects - whether the objects are also equal.

assertHashCodeNotEquals

public static <T> void assertHashCodeNotEquals(T obj,
                                               T obj2)
This method makes sure that the hashCodes are not equal. And that they are not .equals. This is because two objects of the same type cannot be .equals if they have different hashCodes.

Type Parameters:
T -
Parameters:
obj -
obj2 -

assertEqualsContract

public static <T> void assertEqualsContract(T info,
                                            T info2,
                                            T info3)
This method asserts that the equals contract is upheld by type T.

Type Parameters:
T -
Parameters:
info - an instance of T
info2 - a different instance of T that is .equal to info
info3 - an instance of T that is not equal to info


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.