commonMain.com.episode6.mockspresso2.Defaults.kt Maven / Gradle / Ivy
package com.episode6.mockspresso2
import com.episode6.mockspresso2.api.FallbackObjectMaker
import com.episode6.mockspresso2.api.RealObjectMaker
import com.episode6.mockspresso2.plugins.core.reflect.reflectionRealObjectMaker
import com.episode6.mockspresso2.reflect.DependencyKey
/**
* The default real object maker uses the default constructor to create objects
*/
fun defaultRealObjectMaker(): RealObjectMaker = reflectionRealObjectMaker()
/**
* The default fallback object maker is non-functional and throws exceptions if any dependencies required by
* real object are not explicitly added to the mockspresso instance.
*/
fun defaultFallbackObjectMaker(): FallbackObjectMaker = object : FallbackObjectMaker {
override fun makeObject(key: DependencyKey): T = throw NoFallbackMakerProvidedError(key)
}