Interface IteratorContract<E,I extends Iterable<E>>
- Type Parameters:
E
- The element type being tested.I
- The type of the iterator being tested.
- All Superinterfaces:
CollectionContractConfig
,CollectionContractSupport<E,
,I> CollectionProviderSupport<E,
,I> ContractSupport<I>
,ElementProviderSupport<E>
,ProviderSupport<I>
,SupportedMethods
- All Known Subinterfaces:
CollectionContract<E,
,C> IterableContract<E,
,I> ListContract<E,
,L> SequencedCollectionContract<E,
,C> SpliteratorContract<E,
I>
This interface tests if a iterable class has implemented the
iterator()
method
correctly and that the iterator that is returned satisfies the Iterator
contract.- Since:
- 1.0.0
- Author:
- evanbergstrom
- See Also:
-
Field Summary
Fields inherited from interface org.soliscode.test.contract.support.CollectionContractSupport
DEFAULT_SIZE
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Tests that the [Iterator#forEachRemaining[] method throws for null action.default void
Tests that theIterator.forEachRemaining(java.util.function.Consumer<? super E>)
method works over an entire collection.default void
Tests that theIterator.forEachRemaining(java.util.function.Consumer<? super E>)
method works over the remaining collection.default void
Tests that theIterator.hasNext()
andIterator.next()
methods work for a collection with elements.default void
Tests that theIterator.hasNext()
andIterator.next()
methods work for an empty collection.default void
Tests that theIterator.remove()
method works.default void
Tests that theIterator.remove()
method throws andIllegalStateException
if it is called without first callingnext
, or it is called twice in a row without a call tonext
in between.Methods inherited from interface org.soliscode.test.contract.CollectionContractConfig
permitDuplicates, permitIncompatibleTypes, permitNulls
Methods inherited from interface org.soliscode.test.contract.support.CollectionProviderSupport
provider
Methods inherited from interface org.soliscode.test.contract.support.ElementProviderSupport
elementProvider
Methods inherited from interface org.soliscode.test.SupportedMethods
supportsMethod
-
Method Details
-
testIteratorOverEmptyCollection
@Test default void testIteratorOverEmptyCollection()Tests that theIterator.hasNext()
andIterator.next()
methods work for an empty collection. -
testIteratorOverCollectionWithElements
@Test default void testIteratorOverCollectionWithElements()Tests that theIterator.hasNext()
andIterator.next()
methods work for a collection with elements. -
testIteratorRemove
@Test default void testIteratorRemove()Tests that theIterator.remove()
method works. -
testIteratorRemoveThrowsOnIllegalState
@Test default void testIteratorRemoveThrowsOnIllegalState()Tests that theIterator.remove()
method throws andIllegalStateException
if it is called without first callingnext
, or it is called twice in a row without a call tonext
in between. -
testForEachRemainingOverEntireCollection
@Test default void testForEachRemainingOverEntireCollection()Tests that theIterator.forEachRemaining(java.util.function.Consumer<? super E>)
method works over an entire collection. -
testForEachRemainingOverPartialCollection
@Test default void testForEachRemainingOverPartialCollection()Tests that theIterator.forEachRemaining(java.util.function.Consumer<? super E>)
method works over the remaining collection. -
testForEachRemainingForNullAction
@Test default void testForEachRemainingForNullAction()Tests that the [Iterator#forEachRemaining[] method throws for null action.
-