public final class Tests extends Object
Modifier and Type | Method and Description |
---|---|
static <T extends Comparable<? super T>> |
testComparable(T o,
T smaller,
T equal,
T greater)
Tests the contract of the
Comparable interface without consistency with Object.equals(java.lang.Object) . |
static <T extends Comparable<? super T>> |
testComparableConsistentWithEquals(T o,
T smaller,
T equal,
T greater)
Tests the contract of the
Comparable interface and the consistency with Object.equals(java.lang.Object) . |
static <T> void |
testComparator(Comparator<? super T> comparator,
T o,
T smaller,
T equal,
T greater,
boolean nullValueSupported)
Tests the contract of the
Comparator interface without consistency with Object.equals(java.lang.Object) . |
static <T> void |
testComparatorConsistentWithEquals(Comparator<? super T> comparator,
T o,
T smaller,
T equal,
T greater,
boolean nullValueSupported)
Tests the contract of the
Comparator interface and the consistency with Object.equals(java.lang.Object) . |
static void |
testEquals(Object o1,
Object o2,
Object o3,
Object... unequalObjects)
Tests the equals method of an object for reflexivity, symmetry, transitivity and non-nullity and tests if unequal objects are not equal.
|
static void |
testHashCode(Object o1,
Object o2)
Tests if equal objects have equal hashCode.
|
static <T> void |
testOrder(Comparator<? super T> comparator,
T... objects)
Tests the sorted order of the objects provided in ascending order.
|
static <T extends Comparable<? super T>> |
testOrder(T... objects)
Tests the sorted order of the objects provided in ascending order.
|
public static void testHashCode(Object o1, Object o2)
o1
- object 1o2
- object 2public static void testEquals(Object o1, Object o2, Object o3, Object... unequalObjects)
o1
- object 1o2
- object 2o3
- object 3unequalObjects
- unequal objectspublic static <T> void testComparatorConsistentWithEquals(Comparator<? super T> comparator, T o, T smaller, T equal, T greater, boolean nullValueSupported)
Comparator
interface and the consistency with Object.equals(java.lang.Object)
.T
- the type of the objects to comparecomparator
- the comparator to testo
- the reference objectsmaller
- an object smaller than the reference objectequal
- an object equal to the reference objectgreater
- an object greater than the reference objectnullValueSupported
- true if the comparator supports null arguments, else falsepublic static <T> void testComparator(Comparator<? super T> comparator, T o, T smaller, T equal, T greater, boolean nullValueSupported)
Comparator
interface without consistency with Object.equals(java.lang.Object)
.T
- the type of the objects to comparecomparator
- the comparator to testo
- the reference objectsmaller
- an object smaller than the reference objectequal
- an object equal to the reference objectgreater
- an object greater than the reference objectnullValueSupported
- true if the comparator supports null arguments, else falsepublic static <T> void testOrder(Comparator<? super T> comparator, T... objects)
T
- the type of the objects to comparecomparator
- the comparator to testobjects
- the objects provided in ascending orderpublic static <T extends Comparable<? super T>> void testComparableConsistentWithEquals(T o, T smaller, T equal, T greater)
Comparable
interface and the consistency with Object.equals(java.lang.Object)
.T
- the type of the comparable objects to compareo
- the reference objectsmaller
- an object smaller than the reference objectequal
- an object equal to the reference objectgreater
- an object greater than the reference objectpublic static <T extends Comparable<? super T>> void testComparable(T o, T smaller, T equal, T greater)
Comparable
interface without consistency with Object.equals(java.lang.Object)
.T
- the type of the comparable objects to compareo
- the reference objectsmaller
- an object smaller than the reference objectequal
- an object equal to the reference objectgreater
- an object greater than the reference objectpublic static <T extends Comparable<? super T>> void testOrder(T... objects)
T
- the type of the comparable objects to compareobjects
- the objects provided in ascending orderCopyright © 2002–2019 SoftSmithy. All rights reserved.