Setting up a mock like this causes problems becaus...
# mockk
e
Setting up a mock like this causes problems because the x in every will not refer to the x on the mocked
Point
Copy code
data class Point(val x: Int, val y: Int) 

val x = 7
val mockPoint = mockk<Point> { 
  every { x } returns x
}
If the receiver in the
every
block would be <T> (or Point in this case), I believe x would bind correctly, but perhaps that causes other issues?
k
You can use labels
Copy code
val mockPoint = mockk<Point> {
    every { this@mockk.x } returns x
}
☝️ 1
🙏 1