mockFactoryOf

fun mockFactoryOf(vararg classes: KClass<*>, block: MockFactoryConfigurer.Block = { }): MockFactory(source)

Returns a MockFactory that is able to create mocks of given classes.

Unlike dev.mokkery.mock, which requires the mocked type to be known at compile time, the returned factory creates mocks from a KType resolved at runtime, as long as it matches one of classes.

Each element of classes must be a class literal (e.g. Foo::class) and its type must be supported by dev.mokkery.mock.


Returns a MockFactory that is able to create mocks of given classes. Every mock created by the returned factory is a child of given MokkerySuiteScope.

Unlike dev.mokkery.mock, which requires the mocked type to be known at compile time, the returned factory creates mocks from a KType resolved at runtime, as long as it matches one of classes.

Each element of classes must be a class literal (e.g. Foo::class) and its type must be supported by dev.mokkery.mock.