I'm trying to mock a specific instance, but doesn'...
# mockk
m
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
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
Hi, I'd responded to your previous comment before, it was just equals I needed. I had not realised my test was wrong
o
oh sorry, I've seen it, just confused a bit... notification just have arrived, or something alike