Interface CollectionProvider<E,I extends Iterable<E>>

Type Parameters:
E - the element type for the iterable
I - the iterable type.
All Superinterfaces:
ObjectProvider<I>
All Known Implementing Classes:
FunctionalCollectionProvider

public interface CollectionProvider<E,I extends Iterable<E>> extends ObjectProvider<I>
Provides instances of Collection for use in testing.
Since:
1.0.0
Author:
evanbergstrom
  • Method Details

    • elementProvider

      @NotNull @NotNull ObjectProvider<E> elementProvider()
      Returns the element provider used to create elements for instances of the collection.
      Returns:
      the element provider.
    • emptyInstance

      @NotNull I emptyInstance()
      Creates an instance of iterable with no elements.
      Returns:
      and instance of the iterable
    • createInstance

      @NotNull I createInstance(@NotNull @NotNull Collection<E> c)
      Creates an instance of iterable with the same elements as in the specified collection.
      Parameters:
      c - the elements to use for the iterable.
      Returns:
      an instance of the iterable.
    • createInstance

      @NotNull I createInstance(int seed)
      Creates an instance of iterable being tested based upon an integer seed value. Two iterables created with the same seed value should have the same number of elements and the elements in the same iteration position should hav the same value. Two iterables with different seed values should have either different numbers of elements, elements with different values, or both.
      Specified by:
      createInstance in interface ObjectProvider<E>
      Parameters:
      seed - an integer seed to use to create and instance of the iterable.
      Returns:
      an instance of the iterable.
    • createSingleton

      @NotNull I createSingleton()
      Creates an instance of iterable with a single element.
      Returns:
      and instance of the iterable
    • createSingleton

      @NotNull I createSingleton(E e)
      Creates an instance of iterable with a single element.
      Parameters:
      e - the element for the iterable.
      Returns:
      and instance of iterable.
    • createInstance

      @NotNull I createInstance(@NotNull E[] elements)
      Creates an instance of iterable with the same elements provided.
      Parameters:
      elements - the elements for the iterable.
      Returns:
      and instance of iterable.
      Throws:
      NullPointerException - if the argument is null.
    • createInstanceWithUniqueElements

      @NotNull I createInstanceWithUniqueElements()
      Create an iterable with a set of elements that does not contain any duplicate values.
      Returns:
      an instance of the iterable.
    • createInstanceWithUniqueElements

      @NotNull I createInstanceWithUniqueElements(int size)
      Create an iterable with a set of elements of a specified length that does not contain any duplicate values.
      Parameters:
      size - the number of elements in the iterable.
      Returns:
      an instance of the iterable.
    • createInstanceWithUniqueElements

      @NotNull I createInstanceWithUniqueElements(int size, int seed)
      Create an iterable with a set of elements of a specified length and using the specified seed value that does not contain any duplicate values.
      Parameters:
      size - the number of elements in the iterable.
      seed - the seed value to use to create the elements.
      Returns:
      an instance of the iterable.