sequentially
infix fun <T> BlockingAnsweringScope<T>.sequentially(block: BlockingSequentialAnswerBuilder<T>.() -> Unit)
Function call will answer sequentially with answers defined in block.
Example:
every { dependency.getString(any()) } sequentially {
returns("1")
returns("2")
}
dependency.getString("a") // returns "1"
dependency.getString("a") // returns "2"
dependency.getString("a") // fails with no more answers
Content copied to clipboard
infix fun <T> SuspendAnsweringScope<T>.sequentially(block: SuspendSequentialAnswerBuilder<T>.() -> Unit)
Function call will answer sequentially with answers defined in block.
Example:
everySuspend { dependency.getString(any()) } sequentially {
returns("1")
returns("2")
}
dependency.getString("a") // returns "1"
dependency.getString("a") // returns "2"
dependency.getString("a") // fails with no more answers
Content copied to clipboard