Here you can find the source of assertEquality(Object original, Object equal, Object... notEqual)
public static void assertEquality(Object original, Object equal, Object... notEqual)
//package com.java2s; //License from project: Open Source License public class Main { public static void assertEquality(Object original, Object equal, Object... notEqual) { if (!original.equals(equal)) { throw new AssertionError("Objects where not equal " + original + " != " + equal); }// w w w . j a v a 2s . c o m if (original.hashCode() != equal.hashCode()) { throw new AssertionError("Equal objects did not have same hash :" + original + "(" + original.hashCode() + ")" + " " + equal + "(" + equal.hashCode() + ")"); } for (Object notEqualObject : notEqual) { checkNotEqual(original, notEqualObject); checkNotEqualHash(original, notEqualObject); } } private static void checkNotEqual(Object original, Object notEqualObject) { if (original.equals(notEqualObject)) { throw new AssertionError("Unequal objects where actually equal: " + original + " == " + notEqualObject); } } private static void checkNotEqualHash(Object original, Object notEqualObject) { if (original.hashCode() == notEqualObject.hashCode()) { throw new AssertionError("Unequal objects have same hash :" + original + "(" + original.hashCode() + ")" + " " + notEqualObject + "(" + notEqualObject.hashCode() + ")"); } } }