public final class EqualsTestUtil extends Object
Object.equals(Object)
and
Object.hashCode()
are implemented correctly.Modifier | Constructor and Description |
---|---|
private |
EqualsTestUtil()
Prevent instantiation of utility class.
|
Modifier and Type | Method and Description |
---|---|
static <T> void |
assertEqualsImplementedCorrectly(Callable<T> objectBuilder)
Builds two objects the same way and checks if they are equal.
|
static <T> void |
assertEqualsImplementedCorrectly(Callable<T> objectBuilder1,
Callable<T> objectBuilder2)
Builds two objects and ensures that they are equal.
|
static void |
assertEqualsImplementedCorrectly(Object o1,
Object o2)
Take two objects and ensure their are implemented correctly.
|
static <T> void |
assertEqualsImplementedCorrectly(T o)
Take a single object and ensure its equality is implemented correctly.
|
public static <T> void assertEqualsImplementedCorrectly(Callable<T> objectBuilder)
T
- typeobjectBuilder
- object builderpublic static <T> void assertEqualsImplementedCorrectly(Callable<T> objectBuilder1, Callable<T> objectBuilder2)
T
- typeobjectBuilder1
- first object builderobjectBuilder2
- second object builderpublic static void assertEqualsImplementedCorrectly(Object o1, Object o2)
Object.equals(Object)
is implemented correctly.
The generic check is not put in to allow testing with different classes
o1
- first objecto2
- second objectpublic static <T> void assertEqualsImplementedCorrectly(T o)
T
- typeo
- objectCopyright © 2012–2015 Trajano. All rights reserved.