FixtureMonkey

Generating

FixtureMonkey with default options

FixtureMonkey fixtureMonkey = FixtureMonkey.create();

FixtureMonkey with custom options

FixtureMonkey fixtureMonkey = FixtureMonkey.builder()
	+ options...
    .build();

Option

Alter option:

OptionDescriptionLink
arbitraryValidatorArbitrary sampled value is validated by arbitraryValidator. The default validator is new DefaultArbitraryValidator().ArbitraryValidator
defaultArbitraryContainerInfoDefault size for a randomly generated instance of container type. The default value is new ArbitraryContainerInfo(0, defaultArbitraryContainerMaxSize, false).
defaultArbitraryContainerMaxSizeDefault max size for a randomly generated instance of container type. The default value is 3.
defaultNullInjectGeneratorDetermines when a null instance is created. The default value is new DefaultNullInjectGenerator(...).
nullableContainerDetermines whether to generate a randomly generated container instance. The default value is false.
nullableElementDetermines whether to generate a randomly generated element instance. The default value is false.
defaultNotNullDetermines whether to generate a null instance. The default value is false.
defaultObjectPropertyGeneratorDetermines how to generate ObjectProperty. The default value is DEFAULT_OBJECT_PROPERTY_GENERATOR.ObjectProperty
defaultPropertyGeneratorDetermines how to generate child properties. The default value is new DefaultPropertyGenerator().
defaultPropertyNameResolverDetermines how property resolves name. The default value is DEFAULT_PROPERTY_NAME_RESOLVER.
javaArbitraryResolverResolves how annotations apply to default Java classes. The default value is new JavaArbitraryResolver() {}.
javaTimeArbitraryResolverResolves how annotations apply to default Java Time/Date classes. The default value is new JavaTimeArbitraryResolver() {}.
javaTypeArbitraryGeneratorDetermines a default value for default Java classes. The default value is new JavaTypeArbitraryGenerator() {}.
javaTimeTypeArbitraryGeneratorDetermines a default value for default Java Time/Date classes. The default value is new JavaTimeTypeArbitraryGenerator() {}.
manipulatorOptimizerDetermines how manipulators are optimized. The default value is new NoneManipulatorOptimizer().
monkeyExpressionFactoryDetermines general expression. The default value is new ArbitraryExpressionFactory().
objectIntrospectorDetermines how to create an instance. The default value is BeanArbitraryIntrospector.INSTANCE.ArbitraryIntrospector
useExpressionStrictModeDetermines whether to throw an exception if a property referenced by a given expression does not exist. The default value is false.

Add option

OptionDescriptionLink
addContainerTypeAdd user-defined container typeArbitraryIntrospector
addExceptGenerateClassDo not create an instance of the given class
addExceptGenerateClassesDo not create an instance of the given classes
addExceptGeneratePackageDo not create an instance of any classes which package starts with given package
addExceptGeneratePackagesDo not create an instance of any classes which package starts with given packages
pushExceptGenerateTypeDo not create an instance of any classes which property is matched by matcher
pushContainerIntrospectorDetermines how to create an instance of given container typeArbitraryIntrospector
pluginAdd new plugin
pushArbitraryContainerInfoGeneratorDetermines size for an instance of given container type
pushFixtureCustomizerDetermines how to customize composing properties and an instance of given propertyFixtureCustomizer
pushArbitraryIntrospectorDetermines how to create an instance of given propertyArbitraryIntrospector
pushObjectPropertyGeneratorDetermines how to generate ObjectProperty for given propertyObjectProperty
pushContainerPropertyGeneratorDetermines how to generate ContainerProperty for given propertyContainerProperty
pushPropertyGeneratorDetermines how to generate child properties for given property
pushPropertyNameResolverDetermines how property resolves name for given property
pushNullInjectGeneratorDetermines when a null instance is created for given property
registerDetermines default ArbitraryBuilder for given property
registerGroupDetermines default ArbitraryBuilder for given properties in a group class