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

commonMain.com.zegreatrob.minspy.Spy.kt Maven / Gradle / Ivy

There is a newer version: 12.1.41
Show newest version
package com.zegreatrob.minspy

interface Spy {
    val spyReceivedValues: MutableList

    val callCount: Int get() = spyReceivedValues.size

    val spyReturnValues: MutableList

    val spyReturnWhenGivenValues: MutableMap

    @Suppress("unused")
    infix fun spyWillReturn(values: Collection) {
        spyReturnValues += values
    }

    infix fun spyWillReturn(value: O) {
        spyReturnValues += value
    }

    fun whenever(receive: I, returnValue: O) {
        spyReturnWhenGivenValues[receive] = returnValue
    }

    fun cancel(): Nothing = throw NotImplementedError("Will not implement unused collaborator")
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy