mockito / mockito-kotlin

Using Mockito with Kotlin
MIT License
3.1k stars 200 forks source link

spy call real method for doReturn when #374

Open ericntw opened 4 years ago

ericntw commented 4 years ago

It's unexpected because:

val someObject = Mockito.spy(SomeClass(dependency1, dependency2))
// ...
Mockito.doReturn(someResult).`when`(someObject).someMethod(param1)

Does not call the real someMethod

Or is this library's spy is intended to work differently from Mockito's spy? 🤔

bohsen commented 4 years ago

@ericntw Sounds like a duplicate of either #319 or #369. What's the output of your test?

bohsen commented 4 years ago

Check answer here.