Altering the way of instantiating
1. Altering instantiating
BeanArbitraryIntrospector
Preconditions
- No args constructor
- Setter
FieldReflectionArbitraryIntrospector
Preconditions
- No args constructor
BuilderArbitraryIntrospector
Preconditions
- Builder
ConstructorPropertiesIntrospector
Preconditions
Should satisfy one of below preconditions
- record type
- lombok
@Value
, enabledlombok.anyConstructor.addConstructorProperties=true
option - any constructors with
@ConstructorProperties
Multiple constructors with record would be instantiated by constructor with
@ConstructorProperties
FactoryMethodArbitraryIntrospector
Preconditions
- static factory method
PrimaryConstructorArbitraryIntrospector
Preconditions
- Kotlin class
- Primary constructor.
JacksonArbitraryIntrospector
This practice should add extra module because it depends on third-party library
Jackson
Preconditions
- Adding
fixture-monkey-jackson
dependency - serializable / deserializable by Jackson
2. Altering objectIntrospector
option
FixtureMonkey fixtureMonkey = FixtureMonkey.builder()
.objectIntrospector(selectedIntrospector)
.build();