Class AbstractCollectionTester<E>
java.lang.Object
junit.framework.Assert
junit.framework.TestCase
com.google.common.collect.testing.AbstractTester<OneSizeTestContainerGenerator<C,E>>
com.google.common.collect.testing.AbstractContainerTester<Collection<E>,E>
com.google.common.collect.testing.AbstractCollectionTester<E>
- Type Parameters:
E- the element type of the collection to be tested.
- All Implemented Interfaces:
junit.framework.Test
- Direct Known Subclasses:
AbstractListTester,AbstractMultisetTester,AbstractQueueTester,AbstractSetTester,CollectionAddAllTester,CollectionAddTester,CollectionClearTester,CollectionContainsAllTester,CollectionContainsTester,CollectionCreationTester,CollectionEqualsTester,CollectionForEachTester,CollectionIsEmptyTester,CollectionIteratorTester,CollectionRemoveAllTester,CollectionRemoveIfTester,CollectionRemoveTester,CollectionRetainAllTester,CollectionSerializationEqualTester,CollectionSerializationTester,CollectionSizeTester,CollectionSpliteratorTester,CollectionStreamTester,CollectionToArrayTester,CollectionToStringTester
Base class for collection testers.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.common.collect.testing.AbstractContainerTester
AbstractContainerTester.ArrayWithDuplicate<E> -
Field Summary
FieldsFields inherited from class com.google.common.collect.testing.AbstractContainerTester
container, samples -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Collection<E>protected E[]protected voidEquivalent toexpectMissing(null)except that the call tocontains(null)is permitted to throw aNullPointerException.protected voidprotected voidprotected Collection<E>resetContainer(Collection<E> newContents) Replaces the existing container under test with a new container.Methods inherited from class com.google.common.collect.testing.AbstractContainerTester
createArrayWithDuplicateElement, createDisjointCollection, createOrderedArray, createSamplesArray, e0, e1, e2, e3, e4, emptyCollection, expectAdded, expectAdded, expectAdded, expectContents, expectContents, expectMissing, expectUnchanged, getNullLocation, getNumElements, getOrderedElements, getSampleElements, getSampleElements, resetContainer, setUpMethods inherited from class com.google.common.collect.testing.AbstractTester
getName, getSubjectGenerator, getTestMethodName, init, init, tearDownMethods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, run, run, runBare, runTest, setName, toString
-
Field Details
-
collection
-
-
Constructor Details
-
AbstractCollectionTester
public AbstractCollectionTester()
-
-
Method Details
-
actualContents
- Specified by:
actualContentsin classAbstractContainerTester<Collection<E>,E> - Returns:
- the contents of the container under test, for use by
expectContents(E...)and its friends.
-
resetContainer
Description copied from class:AbstractContainerTesterReplaces the existing container under test with a new container. This is useful when a single test method needs to create multiple containers while retaining the ability to useexpectContents(E...)and other convenience methods. The creation of multiple containers in a single method is discouraged in most cases, but it is vital to the iterator tests.- Overrides:
resetContainerin classAbstractContainerTester<Collection<E>,E> - Parameters:
newContents- the new container instance- Returns:
- the new container instance
-
resetCollection
protected void resetCollection()- See Also:
-
createArrayWithNullElement
- Returns:
- an array of the proper size with
nullinserted into the middle element.
-
initCollectionWithNullElement
protected void initCollectionWithNullElement() -
expectNullMissingWhenNullUnsupported
Equivalent toexpectMissing(null)except that the call tocontains(null)is permitted to throw aNullPointerException.- Parameters:
message- message to use upon assertion failure
-