spyFactoryOf

fun spyFactoryOf(vararg classes: KClass<*>, block: SpyFactoryConfigurer.Block = { }): SpyFactory(source)

Returns a SpyFactory that is able to create spies of given classes.

Unlike dev.mokkery.spy, which requires the spied type to be known at compile time, the returned factory creates spies 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.spy.


Returns a SpyFactory that is able to create spies of given classes. Every spy created by the returned factory is a child of given MokkerySuiteScope.

Unlike dev.mokkery.spy, which requires the spied type to be known at compile time, the returned factory creates spies 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.spy.