I'm having an issue with mockito. I'm trying to us...
# test
I'm having an issue with mockito. I'm trying to use the inline mock maker (for Kotlin finals) but in some of the java tests it returns actual objects instead of mocks. Anybody observed this before?
Nobody answers, so time to place an ad. Just in case you dont know. Try http://mockk.io
Hmm, interesting 🤔
Join #mockk for support
Just a thought, are you maybe also using Powermock? I had problems running both
🚫 1
No it should never turn actual.
if you initlize it as a mock, there is no way it can turn into a actual . Although I did see, issues when put together with robolectric
Check your mocking setup
Ah wait
are you using spy?
if so then it will not work if the method is called within class or parent class
you’re defining spy around reference and should use that reference to see setup behaviour
however when you call this method within class it uses
which of course is not stubbed and will run real implementations
I hope it helps
Late update, I was confused because with bytebuddy it looks like the original object when it's a final object instead of having the special type the old mock maker made. So all good 🙂