class RandomProviderConfig: Any

Configuration for RandomClassProvider.randomClassInstance.

Fields

Name Description
var collectionsSize: Int

the size of the generated Collection type arguments. Defaults to 1.

var constructorParamSize: Int

will try to look up the constructor with specified number of arguments, and use that to create the instance of the class. Defaults to -1, which ignores this configuration property. This takes precedence over constructorFilterStrategy configuration.

var constructorFilterStrategy: ConstructorFilterStrategy

default strategy for looking up a constructor that is used to create the instance of a class. By default, a zero-args constructor will be used.

var fallbackStrategy: FallbackStrategy

fallback strategy that is used to look up a constructor if no constructor with constructorParamSize or constructorFilterStrategy was found.

Methods

namedParameterGenerator

inline fun <K : Any> namedParameterGenerator(parameterName: String, noinline generator: (ParameterInfo)->K?)

Configures generation for a specific named constructor parameter. Overrides all other generators.

Parameters

Name Description
parameterName: String
noinline generator: (ParameterInfo)->K?

ReturnValue

Name Description
Unit

typeGenerator

inline fun <K : Any> typeGenerator(noinline generator: (ParameterInfo)->K)

Configures generation for a specific type of constructor parameter. It can override internal generators (for primitives, for example)

Parameters

Name Description
noinline generator: (ParameterInfo)->K

ReturnValue

Name Description
Unit

nullableTypeGenerator

inline fun <K> nullableTypeGenerator(noinline generator: (ParameterInfo)->K?)

Configures generation for a specific nullable type of constructor parameter. It can override internal generators (for primitives, for example)

Parameters

Name Description
noinline generator: (ParameterInfo)->K?

ReturnValue

Name Description
Unit

collectionElementTypeGenerator

inline fun <K> collectionElementTypeGenerator(noinline generator: (ParameterInfo)->K?)

Configures generation of elements of constructor parameters of Collection types.

Parameters

Name Description
noinline generator: (ParameterInfo)->K?

ReturnValue

Name Description
Unit

mapEntryKeyTypeGenerator

inline fun <K : Any> mapEntryKeyTypeGenerator(noinline generator: (ParameterInfo)->K)

Configures generation of non-null keys of constructor parameters of Map types.

Parameters

Name Description
noinline generator: (ParameterInfo)->K

ReturnValue

Name Description
Unit

mapEntryValueTypeGenerator

inline fun <K> mapEntryValueTypeGenerator(noinline generator: (ParameterInfo)->K?)

Configures generation of values of constructor parameters of Map types.

Parameters

Name Description
noinline generator: (ParameterInfo)->K?

ReturnValue

Name Description
Unit