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=trueoption - any constructors with
@ConstructorProperties
Multiple constructors with record would be instantiated by constructor with
@ConstructorPropertiesFactoryMethodArbitraryIntrospector
Preconditions
- static factory method
PrimaryConstructorArbitraryIntrospector
Preconditions
- Kotlin class
- Primary constructor.
JacksonArbitraryIntrospector
This practice should add extra module because it depends on third-party library
JacksonPreconditions
- Adding
fixture-monkey-jacksondependency - serializable / deserializable by Jackson
2. Altering objectIntrospector option
FixtureMonkey fixtureMonkey = FixtureMonkey.builder()
.objectIntrospector(selectedIntrospector)
.build();