java.lang.Object
de.cuioss.test.generator.impl.CollectionGenerator<T>
- Type Parameters:
T- identifying the type of the object being generated
- All Implemented Interfaces:
TypedGenerator<T>
- Author:
- Oliver Wolff
-
Constructor Summary
ConstructorsConstructorDescriptionCollectionGenerator(TypedGenerator<T> wrapped) Constructor.CollectionGenerator(TypedGenerator<T> wrapped, int lowerBound, int upperBound) Constructor.CollectionGenerator(TypedGenerator<T> wrapped, TypedGenerator<Integer> sizeGenerator) -
Method Summary
Modifier and TypeMethodDescriptionlist()list(int count) Returns aListof the elements provided by the generatornext()Generates the next instance.nextCollection(Class<? extends Iterable<?>> expectedType) Generates a concreteIterable.set()set(int count) Returns aSetof the elements provided by the generatorsortedSet(int count) Returns aSortedSetof the elements provided by the generatorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.cuioss.test.generator.TypedGenerator
getType
-
Constructor Details
-
CollectionGenerator
- Parameters:
wrapped- must not be nullsizeGenerator- must not be null
-
CollectionGenerator
Constructor.- Parameters:
wrapped- generator, must not be nulllowerBound- defines the lower bound of the integer generator that determines the ofCollectionsizeupperBound- defines the upper bound of the integer generator that determines the ofCollectionsize
-
CollectionGenerator
Constructor. using 2 and 12 as bounds of theCollectionsize to be created.- Parameters:
wrapped- generator, must not be null
-
-
Method Details
-
next
Description copied from interface:TypedGeneratorGenerates the next instance.- Specified by:
nextin interfaceTypedGenerator<T>- Returns:
- the next object from the contained
TypedGenerator
-
list
Returns aListof the elements provided by the generator- Parameters:
count- the number of elements within the list- Returns:
- a list with a given number of elements.
-
set
Returns aSetof the elements provided by the generator -
sortedSet
Returns aSortedSetof the elements provided by the generator -
set
- Returns:
- a
Setwith a random number of elements as maximum.
-
list
- Returns:
- a
Listwith a random number of elements as maximum.
-
sortedSet
- Returns:
- a
SortedSetwith a random number of elements as maximum.
-
nextCollection
Generates a concreteIterable. It is smart enough to determine whether the elements are to be wrapped in aList,Set,CollectionorSortedSet.
-