public abstract class AbstractTestComparator extends AbstractTestObject
Concrete subclasses declare the comparator to be tested. They also declare certain aspects of the tests.
COLLECTIONS_MAJOR_VERSION| Constructor and Description |
|---|
AbstractTestComparator(java.lang.String testName)
JUnit constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCanonicalComparatorName(java.lang.Object object) |
abstract java.util.List |
getComparableObjectsOrdered()
Implement this method to return a list of sorted objects.
|
java.lang.String |
getCompatibilityVersion()
Overrides superclass to set the compatability to version 2
as there were no Comparators in version 1.x.
|
abstract java.util.Comparator |
makeComparator()
Implement this method to return the comparator to test.
|
java.lang.Object |
makeObject()
Implements the abstract superclass method to return the comparator.
|
protected void |
randomizeObjects(java.util.List list)
Randomize the list.
|
protected void |
reverseObjects(java.util.List list)
Reverse the list.
|
protected void |
sortObjects(java.util.List list,
java.util.Comparator comparator)
Sort the list.
|
boolean |
supportsEmptyCollections()
Overrides superclass to block tests.
|
boolean |
supportsFullCollections()
Overrides superclass to block tests.
|
void |
testComparatorCompatibility()
Compare the current serialized form of the Comparator
against the canonical version in CVS.
|
void |
testComparatorIsSerializable()
Nearly all Comparators should be Serializable.
|
void |
testEmptyListSort()
Test sorting an empty list
|
void |
testRandomListSort()
Test sorting a random list.
|
void |
testReverseListSort()
Test sorting a reversed list.
|
getCanonicalEmptyCollectionName, getCanonicalFullCollectionName, isEqualsCheckable, isTestSerialization, readExternalFormFromBytes, readExternalFormFromDisk, skipSerializedCanonicalTests, testCanonicalEmptyCollectionExists, testCanonicalFullCollectionExists, testEqualsNull, testObjectEqualsSelf, testObjectHashCodeEqualsContract, testObjectHashCodeEqualsSelfHashCode, testSerializeDeserializeThenCompare, testSimpleSerialization, writeExternalFormToBytes, writeExternalFormToDiskclone, ignoredTests, makeSuite, toStringpublic AbstractTestComparator(java.lang.String testName)
testName - the test class namepublic abstract java.util.Comparator makeComparator()
public abstract java.util.List getComparableObjectsOrdered()
public java.lang.Object makeObject()
makeObject in class AbstractTestObjectpublic boolean supportsEmptyCollections()
supportsEmptyCollections in class AbstractTestObjectpublic boolean supportsFullCollections()
supportsFullCollections in class AbstractTestObjectpublic java.lang.String getCompatibilityVersion()
getCompatibilityVersion in class AbstractTestObjectnull if this object shouldn't be
tested for compatibility with previous versions.protected void reverseObjects(java.util.List list)
protected void randomizeObjects(java.util.List list)
protected void sortObjects(java.util.List list,
java.util.Comparator comparator)
public void testEmptyListSort()
public void testReverseListSort()
public void testRandomListSort()
public void testComparatorIsSerializable()
public java.lang.String getCanonicalComparatorName(java.lang.Object object)
public void testComparatorCompatibility()
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionCopyright © 2001-2015 Apache Software Foundation. All Rights Reserved.