-
Notifications
You must be signed in to change notification settings - Fork 0
Home
By default Mr Polite will search 3 levels in the fields hierarchy to create objects.
Parameters:
depth - how many levels
A range for all the fields containing numbers.
Parameters:
min - the minimum
max - the maximum
The maximum length for all the generated strings.
Parameters:
len - the maximum length
Generate strings using the field name. For instance, a field
String name;
will contain the value "name".
Set a specific value in some fields, searching by name.
Parameters:
fieldNameRegex - A regular expression to identify the field by name.
value - the value to set
Set a specific value in fields with a specific type.
Type Parameters:
K - the class and the value must be of the same type
Parameters:
clazz - the type of the field
value - the value to set
Set a http link to an image, on fields searching by name. It creates a link using the excellent service "http://lorempixel.com".
Parameters:
fieldNameRegex - A regular expression to identify the field by name.
width - the image width
height - the image height
A seed to randomize the generated values. Useful when you want to generate the same values, for instance, for testing purposes.
Parameters:
seed - the seed value
Mr Polite will try to create collections/arrays. Define here a range for the desired size.
Parameters:
min - the minimum size
max - the maximum size
Exclude fields searching by name. The excluded fields will not be changed.
Parameters:
fieldNameRegex - A regular expression to identify the field by name.
Exclude fields searching by type. The excluded fields will not be changed.
Parameters:
clazz - The type to be ignored.
Mr Polite needs to know which types must be used in the generic fields. For instance:
Listener<Foo> listener = MrPolite.one(Listener.class).please();
Mr Polite doesn't know you want a type Foo in the generics, so you must specify it.
Listener<Foo> listener = MrPolite.one(Listener.class).withGenerics(Foo.class).please();
Parameters:
clazz - the class or classes to use for generics. The number of classes must be the same number of generics declared in the expected object.
By default all the values in all the fields are set to a new value. Here the default behavior can be changed.
Parameters:
override - true to override all values, false otherwise.
By default all final values in all the fields are not touched. Here you can force to override them, useful for Kotlin data classes.