So in the service I am testing, I have a depending service which is taking an object and does some augmenting on it. I want to mock the part the depending service is doing and make the mock return exactly what it's receiving. Problem is I don't have access to that.
I tried something like this:
val captureMyObject = slot<MyObject>()
every { serviceX.doSomething(capture(captureMyObject)) }
returns captureMyObject.captured
But it fails with: kotlin.UninitializedPropertyAccessException: lateinit property captured has not been initialized