igorvd
05/14/2019, 7:36 PMclass ViewModel {
fun loadSomeStuff() {
myObject.asyncOperation(object : Callback {
//callback methods implementation
})
}
}
I know if I change the callback for a parameter in my class, it will be easily mocked. But, in my opinion it doesn't make sense, because it's related to the operation I need in the method.
(This example is just for learning purposes, I was trying to teach a colleague about unit tests, and I got stocked in this scenario)Hadi Tok
05/14/2019, 10:04 PMevery { spy.magnify(any()) } answers { firstArg<Int>() * 2 }
this lineanswers
and firstArg
you will be able to access first arguement of a mocked function. with this you can do whatever you needigorvd
05/15/2019, 5:46 PM