public abstract class AbstractTestSet extends AbstractTestCollection
Set methods and contracts.
Since Set doesn't stipulate much new behavior that isn't already
found in Collection, this class basically just adds tests for
Set.equals(java.lang.Object) and Set.hashCode() along with an updated
verify() that ensures elements do not appear more than once in the
set.
To use, subclass and override the makeEmptySet()
method. You may have to override other protected methods if your
set is not modifiable, or if your set restricts what kinds of
elements may be added; see AbstractTestCollection for more details.
collection, confirmedCOLLECTIONS_MAJOR_VERSION| Constructor and Description |
|---|
AbstractTestSet(java.lang.String name)
JUnit constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Set |
getConfirmedSet()
Return the
AbstractTestCollection.confirmed fixture, but cast as a Set. |
java.util.Set |
getSet()
Return the
AbstractTestCollection.collection fixture, but cast as a Set. |
boolean |
isEqualsCheckable()
Set equals method is defined.
|
java.util.Collection |
makeCollection()
Makes an empty collection by invoking
makeEmptySet(). |
java.util.Collection |
makeConfirmedCollection()
Returns an empty Set for use in modification testing.
|
java.util.Collection |
makeConfirmedFullCollection()
Returns a full Set for use in modification testing.
|
abstract java.util.Set |
makeEmptySet()
Makes an empty set.
|
java.util.Collection |
makeFullCollection()
Makes a full collection by invoking
makeFullSet(). |
java.util.Set |
makeFullSet()
Makes a full set by first creating an empty set and then adding
all the elements returned by
AbstractTestCollection.getFullElements(). |
void |
testSetEquals()
Tests
Set.equals(Object). |
void |
testSetHashCode()
Tests
Set.hashCode(). |
void |
verify()
Provides additional verifications for sets.
|
areEqualElementsDistinguishable, cloneMapEntry, getFullElements, getFullNonNullElements, getFullNonNullStringElements, getOtherElements, getOtherNonNullElements, getOtherNonNullStringElements, isAddSupported, isFailFastSupported, isNullSupported, isRemoveSupported, makeObject, resetEmpty, resetFull, testCollectionAdd, testCollectionAddAll, testCollectionClear, testCollectionContains, testCollectionContainsAll, testCollectionIsEmpty, testCollectionIterator, testCollectionIteratorFailFast, testCollectionIteratorRemove, testCollectionRemove, testCollectionRemoveAll, testCollectionRetainAll, testCollectionSize, testCollectionToArray, testCollectionToArray2, testCollectionToString, testSerializeDeserializeThenCompare, testUnsupportedAdd, testUnsupportedRemovegetCanonicalEmptyCollectionName, getCanonicalFullCollectionName, getCompatibilityVersion, isTestSerialization, readExternalFormFromBytes, readExternalFormFromDisk, skipSerializedCanonicalTests, supportsEmptyCollections, supportsFullCollections, testCanonicalEmptyCollectionExists, testCanonicalFullCollectionExists, testEqualsNull, testObjectEqualsSelf, testObjectHashCodeEqualsContract, testObjectHashCodeEqualsSelfHashCode, testSimpleSerialization, writeExternalFormToBytes, writeExternalFormToDiskclone, ignoredTests, makeSuite, toStringpublic AbstractTestSet(java.lang.String name)
name - name for testpublic void verify()
verify in class AbstractTestCollectionpublic boolean isEqualsCheckable()
isEqualsCheckable in class AbstractTestCollectionpublic java.util.Collection makeConfirmedCollection()
makeConfirmedCollection in class AbstractTestCollectionpublic java.util.Collection makeConfirmedFullCollection()
makeConfirmedFullCollection in class AbstractTestCollectionpublic abstract java.util.Set makeEmptySet()
public java.util.Set makeFullSet()
AbstractTestCollection.getFullElements().
Override if your set does not support the add operation.public final java.util.Collection makeCollection()
makeEmptySet().makeCollection in class AbstractTestCollectionpublic final java.util.Collection makeFullCollection()
makeFullSet().makeFullCollection in class AbstractTestCollectionpublic java.util.Set getSet()
AbstractTestCollection.collection fixture, but cast as a Set.public java.util.Set getConfirmedSet()
AbstractTestCollection.confirmed fixture, but cast as a Set.public void testSetEquals()
Set.equals(Object).public void testSetHashCode()
Set.hashCode().Copyright © 2001-2015 Apache Software Foundation. All Rights Reserved.