| org.apache.commons.collections.BulkTest org.apache.commons.collections.AbstractTestObject
All known Subclasses: org.apache.commons.collections.iterators.AbstractTestIterator, org.apache.commons.collections.buffer.TestBoundedBuffer, org.apache.commons.collections.bag.AbstractTestBag, org.apache.commons.collections.buffer.TestBlockingBuffer, org.apache.commons.collections.comparators.AbstractTestComparator, org.apache.commons.collections.map.AbstractTestMap, org.apache.commons.collections.collection.AbstractTestCollection, org.apache.commons.collections.map.TestIdentityMap,
AbstractTestObject | abstract public class AbstractTestObject extends BulkTest (Code) | | Abstract test class for
java.lang.Object methods and contracts.
To use, simply extend this class, and implement
the
AbstractTestObject.makeObject() method.
If your
Object fails one of these tests by design,
you may still use this base set of cases. Simply override the
test case (method) your
Object fails.
version: $Revision: 155406 $ $Date: 2005-02-26 12:55:26 +0000 (Sat, 26 Feb 2005) $ author: Rodney Waldhoff author: Stephen Colebourne author: Anonymous |
COLLECTIONS_MAJOR_VERSION | final public static int COLLECTIONS_MAJOR_VERSION(Code) | | Current major release for Collections
|
AbstractTestObject | public AbstractTestObject(String testName)(Code) | | JUnit constructor.
Parameters: testName - the test class name |
getCanonicalEmptyCollectionName | protected String getCanonicalEmptyCollectionName(Object object)(Code) | | |
getCanonicalFullCollectionName | protected String getCanonicalFullCollectionName(Object object)(Code) | | |
getCompatibilityVersion | public String getCompatibilityVersion()(Code) | | Get the version of Collections that this object tries to
maintain serialization compatibility with. Defaults to 1, the
earliest Collections version. (Note: some collections did not
even exist in this version).
This constant makes it possible for TestMap (and other subclasses,
if necessary) to automatically check CVS for a versionX copy of a
Serialized object, so we can make sure that compatibility is maintained.
See, for example, TestMap.getCanonicalFullMapName(Map map).
Subclasses can override this variable, indicating compatibility
with earlier Collections versions.
The version, or null if this object shouldn't betested for compatibility with previous versions. |
isEqualsCheckable | public boolean isEqualsCheckable()(Code) | | Returns true to indicate that the collection supports equals() comparisons.
This implementation returns true;
|
isTestSerialization | public boolean isTestSerialization()(Code) | | Is serialization testing supported.
Default is true.
|
makeObject | abstract public Object makeObject()(Code) | | Implement this method to return the object to test.
the object to test |
skipSerializedCanonicalTests | protected boolean skipSerializedCanonicalTests()(Code) | | |
supportsEmptyCollections | public boolean supportsEmptyCollections()(Code) | | Override this method if a subclass is testing an object
that cannot serialize an "empty" Collection.
(e.g. Comparators have no contents)
true |
supportsFullCollections | public boolean supportsFullCollections()(Code) | | Override this method if a subclass is testing an object
that cannot serialize a "full" Collection.
(e.g. Comparators have no contents)
true |
testCanonicalEmptyCollectionExists | public void testCanonicalEmptyCollectionExists()(Code) | | Tests serialization by comparing against a previously stored version in CVS.
If the test object is serializable, confirm that a canonical form exists.
|
testCanonicalFullCollectionExists | public void testCanonicalFullCollectionExists()(Code) | | Tests serialization by comparing against a previously stored version in CVS.
If the test object is serializable, confirm that a canonical form exists.
|
testEqualsNull | public void testEqualsNull()(Code) | | |
testObjectEqualsSelf | public void testObjectEqualsSelf()(Code) | | |
testObjectHashCodeEqualsContract | public void testObjectHashCodeEqualsContract()(Code) | | |
testObjectHashCodeEqualsSelfHashCode | public void testObjectHashCodeEqualsSelfHashCode()(Code) | | |
testSerializeDeserializeThenCompare | public void testSerializeDeserializeThenCompare() throws Exception(Code) | | |
testSimpleSerialization | public void testSimpleSerialization() throws Exception(Code) | | Sanity check method, makes sure that any Serializable
class can be serialized and de-serialized in memory,
using the handy makeObject() method
throws: IOException - throws: ClassNotFoundException - |
writeExternalFormToBytes | protected byte[] writeExternalFormToBytes(Serializable o) throws IOException(Code) | | Converts a Serializable or Externalizable object to
bytes. Useful for in-memory tests of serialization
Parameters: o - Object to convert to bytes serialized form of the Object exception: IOException - |
writeExternalFormToDisk | protected void writeExternalFormToDisk(Serializable o, String path) throws IOException(Code) | | Write a Serializable or Externalizable object as
a file at the given path. NOT USEFUL as part
of a unit test; this is just a utility method
for creating disk-based objects in CVS that can become
the basis for compatibility tests using
readExternalFormFromDisk(String path)
Parameters: o - Object to serialize Parameters: path - path to write the serialized Object exception: IOException - |
|
|