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>

public interface IteratorContract<E,I extends Iterable<E>> extends CollectionContractSupport<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:
  • Method Details

    • testIteratorOverEmptyCollection

      @Test default void testIteratorOverEmptyCollection()
      Tests that the Iterator.hasNext() and Iterator.next() methods work for an empty collection.
    • testIteratorOverCollectionWithElements

      @Test default void testIteratorOverCollectionWithElements()
      Tests that the Iterator.hasNext() and Iterator.next() methods work for a collection with elements.
    • testIteratorRemove

      @Test default void testIteratorRemove()
      Tests that the Iterator.remove() method works.
    • testIteratorRemoveThrowsOnIllegalState

      @Test default void testIteratorRemoveThrowsOnIllegalState()
      Tests that the Iterator.remove() method throws and IllegalStateException if it is called without first calling next, or it is called twice in a row without a call to next in between.
    • testForEachRemainingOverEntireCollection

      @Test default void testForEachRemainingOverEntireCollection()
      Tests that the Iterator.forEachRemaining(java.util.function.Consumer<? super E>) method works over an entire collection.
    • testForEachRemainingOverPartialCollection

      @Test default void testForEachRemainingOverPartialCollection()
      Tests that the Iterator.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.