thanksforallthefish
fun updateParticipant(participant: Participant, update: Participant.() -> Unit)
val participantOrchestrationService: ParticipantOrchestrationService = mockk(relaxed = true) val dummy = Participant() val update = slot<Participant.() -> Unit>() every { participantOrchestrationService.updateParticipant(dummy) { capture(update) } } just Runs update.captured(dummy) dummy should { it.state == State.inactive }
kotlin.UninitializedPropertyAccessException: lateinit property captured has not been initialized
every { participantOrchestrationService.updateParticipant(dummy, captureLambda()) } answers { lambda<Participant.() -> Unit>().invoke(dummy) }
every
update
oleksiyp
updateParticipant
fun updateParticipant(participant: Participant, update: Participant.() -> Unit = {}) : Unit
every { participantOrchestrationService.updateParticipant(dummy, capture(update)) } just Runs
capture
A modern programming language that makes developers happier.