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

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

public class EqualsAssertTestNG
extends Object

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

Author:
AGH CAST Team

Constructor Summary
EqualsAssertTestNG()
           
 
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

EqualsAssertTestNG

public EqualsAssertTestNG()
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.