Interface CollectionProvider<E,I extends Iterable<E>>
- Type Parameters:
E
- the element type for the iterableI
- the iterable type.
- All Superinterfaces:
ObjectProvider<I>
- All Known Implementing Classes:
FunctionalCollectionProvider
Provides instances of
Collection
for use in testing.- Since:
- 1.0.0
- Author:
- evanbergstrom
-
Method Summary
Modifier and TypeMethodDescriptioncreateInstance
(int seed) Creates an instance of iterable being tested based upon an integer seed value.createInstance
(E[] elements) Creates an instance of iterable with the same elements provided.createInstance
(@NotNull Collection<E> c) Creates an instance of iterable with the same elements as in the specified collection.Create an iterable with a set of elements that does not contain any duplicate values.createInstanceWithUniqueElements
(int size) Create an iterable with a set of elements of a specified length that does not contain any duplicate values.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.Creates an instance of iterable with a single element.createSingleton
(E e) Creates an instance of iterable with a single element.@NotNull ObjectProvider
<E> Returns the element provider used to create elements for instances of the collection.Creates an instance of iterable with no elements.Methods inherited from interface org.soliscode.test.provider.ObjectProvider
copyInstance, createEqualObjects, createInstance, createRandoInstances, createUniqueInstances, createUniqueInstances, defaultInstance, equalInstanceSupplier, randomInstanceSupplier, uniqueInstanceSupplier, uniqueInstanceSupplier, uniqueSizeLimit
-
Method Details
-
elementProvider
Returns the element provider used to create elements for instances of the collection.- Returns:
- the element provider.
-
emptyInstance
Creates an instance of iterable with no elements.- Returns:
- and instance of the iterable
-
createInstance
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
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 interfaceObjectProvider<E>
- Parameters:
seed
- an integer seed to use to create and instance of the iterable.- Returns:
- an instance of the iterable.
-
createSingleton
Creates an instance of iterable with a single element.- Returns:
- and instance of the iterable
-
createSingleton
-
createInstance
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 isnull
.
-
createInstanceWithUniqueElements
Create an iterable with a set of elements that does not contain any duplicate values.- Returns:
- an instance of the iterable.
-
createInstanceWithUniqueElements
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
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.
-