captureNullable

inline fun <T : Any> captureNullable(lst: CapturingSlot<T?>): T?(source)

Captures a nullable value to a CapturingSlot.

Uses io.mockk.slot to create capturing slot. Example:

interface FileNetwork {
fun download(name: String): File
}

val network = mockk<FileNetwork>()
val slot = slot<String?>()

every { network.download(captureNullable(slot)) } returns mockk()

network.download("testfile")
// slot.captured is now "testfile"

inline fun <T : Any> captureNullable(lst: MutableList<T?>): T?(source)

Captures a nullable value to a MutableList.

Uses io.mockk.slot to create capturing slot.

See also

for non-nullable arguments.