|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.commons.collections.BulkTest
org.apache.commons.collections.TestObject
org.apache.commons.collections.TestCollection
org.apache.commons.collections.TestSet
Tests base 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() 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 TestCollection for more details.
| Field Summary |
| Fields inherited from class org.apache.commons.collections.TestCollection |
collection, confirmed |
| Fields inherited from class org.apache.commons.collections.TestObject |
COLLECTIONS_MAJOR_VERSION |
| Fields inherited from class org.apache.commons.collections.BulkTest |
verboseName |
| Fields inherited from class junit.framework.TestCase |
|
| Constructor Summary | |
TestSet(java.lang.String name)Constructor. |
|
| Method Summary | |
protected java.util.Set |
getConfirmedSet()Return the TestCollection.confirmed fixture, but cast as a Set. |
protected java.util.Set |
getSet()Return the TestCollection.collection fixture, but cast as a Set. |
protected java.util.Collection |
makeCollection()Makes an empty collection by invoking makeEmptySet(). |
protected java.util.Collection |
makeConfirmedCollection()Returns an empty HashSet for use in modification testing. |
protected java.util.Collection |
makeConfirmedFullCollection()Returns a full HashSet for use in modification testing. |
protected abstract java.util.Set |
makeEmptySet()Makes an empty set. |
protected java.util.Collection |
makeFullCollection()Makes a full collection by invoking makeFullSet(). |
protected java.util.Set |
makeFullSet()Makes a full set by first creating an empty set and then adding all the elements returned by TestCollection.getFullElements(). |
void |
testSetEquals()Tests Set.equals(Object). |
void |
testSetHashCode()Tests Set.hashCode(). |
protected void |
verify()Provides additional verifications for sets. |
| Methods inherited from class org.apache.commons.collections.BulkTest |
clone, ignoredSimpleTests, makeSuite, toString |
| Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, setUp, tearDown |
| Methods inherited from class junit.framework.Assert |
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public TestSet(java.lang.String name)
name - name for test| Method Detail |
protected final java.util.Collection makeCollection()
makeEmptySet().
makeCollection in class TestCollectionprotected final java.util.Collection makeFullCollection()
makeFullSet().
makeFullCollection in class TestCollectionprotected java.util.Set getSet()
TestCollection.collection fixture, but cast as a Set.
protected java.util.Collection makeConfirmedCollection()
HashSet for use in modification testing.
makeConfirmedCollection in class TestCollectionprotected java.util.Collection makeConfirmedFullCollection()
HashSet for use in modification testing.
makeConfirmedFullCollection in class TestCollectionprotected java.util.Set getConfirmedSet()
TestCollection.confirmed fixture, but cast as a Set.
protected abstract java.util.Set makeEmptySet()
protected java.util.Set makeFullSet()
TestCollection.getFullElements(). Override if your set does not support the add operation.
public void testSetEquals()
Set.equals(Object).
public void testSetHashCode()
Set.hashCode().
protected void verify()
verify in class TestCollection
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||