All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy