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, writeExternalFormToDisk
clone, ignoredTests, makeSuite, toString
public 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 AbstractTestObject
public boolean supportsEmptyCollections()
supportsEmptyCollections
in class AbstractTestObject
public boolean supportsFullCollections()
supportsFullCollections
in class AbstractTestObject
public java.lang.String getCompatibilityVersion()
getCompatibilityVersion
in class AbstractTestObject
null
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.IOException
java.lang.ClassNotFoundException
Copyright © 2001-2015 Apache Software Foundation. All Rights Reserved.