commonMain.com.zegreatrob.minspy.Spy.kt Maven / Gradle / Ivy
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