T - the type of collection generatedpublic abstract class CollectionGenerator<T extends Collection> extends ComponentizedGenerator<T>
Base class for generators of Collections, such as Lists and Set.
The generated collection has a number of elements limited by GenerationStatus.size(), or else
by the attributes of a Size marking. The individual elements will have a type corresponding to the
theory parameter's type argument.
| Modifier | Constructor and Description |
|---|---|
protected |
CollectionGenerator(Class<T> type) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRegisterAsType(Class<?> type) |
void |
configure(Size sizeRange)
Tells this generator to add elements to the generated collection a number of times
within a specified minimum and/or maximum, inclusive, chosen with uniform distribution.
|
protected abstract T |
empty() |
T |
generate(SourceOfRandomness random,
GenerationStatus status) |
int |
numberOfNeededComponents() |
addComponentGenerators, canGenerateForParametersOfTypes, componentGenerators, configure, hasComponents, provideRepositorycompatibleWithTypeParameter, typespublic void configure(Size sizeRange)
Tells this generator to add elements to the generated collection a number of times within a specified minimum and/or maximum, inclusive, chosen with uniform distribution.
Note that some kinds of collections disallow duplicates, so the number of elements added may not
be equal to the collection's Collection.size().
sizeRange - annotation that gives the size constraintspublic T generate(SourceOfRandomness random, GenerationStatus status)
generate in class Generator<T extends Collection>public int numberOfNeededComponents()
numberOfNeededComponents in class Generator<T extends Collection>public boolean canRegisterAsType(Class<?> type)
canRegisterAsType in class Generator<T extends Collection>protected abstract T empty()
Copyright © 2015. All Rights Reserved.