T - the type of map generatedpublic abstract class MapGenerator<T extends Map> extends ComponentizedGenerator<T>
Base class for generators of Maps.
The generated map has a number of entries limited by
GenerationStatus.size(), or else by the attributes of a Size
marking. The individual keys and values will have types corresponding to the
theory parameter's type arguments.
| Modifier | Constructor and Description |
|---|---|
protected |
MapGenerator(Class<T> type) |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Size size)
Tells this generator to add key-value pairs to the generated map a
number of times within a specified minimum and/or maximum, inclusive,
chosen with uniform distribution.
|
List<T> |
doShrink(SourceOfRandomness random,
T larger) |
protected T |
empty() |
T |
generate(SourceOfRandomness random,
GenerationStatus status) |
int |
numberOfNeededComponents() |
protected boolean |
okToAdd(Object key,
Object value) |
addComponentGenerators, canGenerateForParametersOfTypes, canRegisterAsType, componentGenerators, configure, hasComponents, provideRepositorycanShrink, compatibleWithTypeParameter, configurationAnnotationsOn, configure, narrow, shrink, typespublic void configure(Size size)
Tells this generator to add key-value pairs to the generated map a number of times within a specified minimum and/or maximum, inclusive, chosen with uniform distribution.
Note that maps disallow duplicate keys, so the number of pairs added
may not be equal to the map's Map.size().
size - annotation that gives the size constraintspublic T generate(SourceOfRandomness random, GenerationStatus status)
public List<T> doShrink(SourceOfRandomness random, T larger)
public int numberOfNeededComponents()
numberOfNeededComponents in class Generator<T extends Map>protected final T empty()
Copyright © 2016. All rights reserved.