Altering Container Size
In Fixture Monkey Container means data structures including Collection. ex. Map, Optional, Set, List…
user-defined data structures are also considered as a Container
This practice deals with manipulation
size
.0. Class
public class Generate {
List<GenerateElement> values;
}
public class GenerateElement {
List<String> values;
}
1. Generating ArbitraryBuilder
ArbitraryBuilder<Generate> generateBuilder = fixtureMonkey.giveMeBuilder(Generate.class);
2-1. Alter field size
generateBuilder.size("values", 5);
generateBuilder.sizeExp(Generate::values, 5);
2-2. Alter field n-th element size
generateBuilder.size("values[n]", 5);
generateBuilder.sizeExp(Generate::values[n], 5);
2-3. Alter field all elements size
generateBuilder.size("values[*]", 5);
generateBuilder.sizeExp(Generate::values["*"], 5);