repeat
fun <T> SuspendSequentialAnswerBuilder<T>.repeat(block: SuspendSequentialAnswerBuilder<T>.() -> Unit): Nothing
fun <T> BlockingSequentialAnswerBuilder<T>.repeat(block: BlockingSequentialAnswerBuilder<T>.() -> Unit): Nothing
Allows to define a set of answers in sequentially that will repeat in cycles.
It might be defined only once.
Example:
everySuspend { dependency.getString(any()) } sequentially {
returns("1")
repeat {
returns("2")
}
}
dependency.getString("a") // returns "1"
dependency.getString("a") // returns "2"
dependency.getString("a") // returns "2"
Content copied to clipboard