pl.edu.agh.cast.util.test
Class EqualsAssert

java.lang.Object
  extended by pl.edu.agh.cast.util.test.EqualsAssert

public class EqualsAssert
extends Object

A utility class providing various methods for testing equals/hashCode methods.

Author:
AGH CAST Team

Constructor Summary
EqualsAssert()
           
 
Method Summary
static void assertEqualsWithHashCode(Object o1, Object o2)
          Asserts that two objects are equal (both ways, i.e.
static void assertNotEqual(Object o1, Object o2)
          Asserts that two objects are not equal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EqualsAssert

public EqualsAssert()
Method Detail

assertEqualsWithHashCode

public static void assertEqualsWithHashCode(Object o1,
                                            Object o2)
Asserts that two objects are equal (both ways, i.e. o1 == o2 && o2 == o1) and that their hashCode is the same (if they're not null). Also, if they're not null, ensures o1 is not equal new Object() and is not equal null. The method checks reflexibility of the equals implementation as well, by testing that o1 == o1.

Parameters:
o1 - first object
o2 - second object

assertNotEqual

public static void assertNotEqual(Object o1,
                                  Object o2)
Asserts that two objects are not equal.

Parameters:
o1 - first object
o2 - second object


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.