slot
Creates new capturing slot.
Slots allow you to capture what arguments a mocked method is called with. When mocking a method using every, pass the slot wrapped with the io.mockk.MockKMatcherScope.capture function in place of a method argument or io.mockk.MockKMatcherScope.any.
Example:
interface FileNetwork {
fun download(name: String): File
}
val network = mockk<FileNetwork>()
val slot = slot<String>()
every { network.download(capture(slot)) } returns mockk()
network.download("testfile")
// slot.captured is now "testfile"Content copied to clipboard