I'm trying to mock a specific instance, but doesn't seem to work. E.g.:
val myData = MyData(min = 3, max = 4)
val myMock = mockk<SomeObject>.apply {
every { someFunc(myData) } returns SOME_ID
}
Inside my SomeObject, it actually creates a MyData with the values 3 and 4, so it's not the exact same instance. So if I change myData to any() in the mock, then it works. Essentially, how do I check against an object that would be equal, not the same instance?
💯 1
o
oleksiyp
12/01/2018, 9:57 PM
I dont see usage, can you submit runnable gist please. Again it should use equals to compare by default. Do you need equals? Or instance compare? You can use more sophisticated matchers if needed(custom if needed). Sorry I didnt gey what does it mean "inside SomeObject it actually creates ..."
m
MrNiamh
12/01/2018, 9:59 PM
Hi, I'd responded to your previous comment before, it was just equals I needed. I had not realised my test was wrong
o
oleksiyp
12/01/2018, 10:14 PM
oh sorry, I've seen it, just confused a bit... notification just have arrived, or something alike