Get class of object, superclass if mocked object
GoogleCodeExporter opened this issue · 3 comments
GoogleCodeExporter commented
If I'm calling "Class.getDeclaredMethod()" on a class and method, and I have to
specify parameters for that method, but one or more of the parameter instances
I have are mocked objects, then the "getDeclaredMethod()" search apparently
fails, because the class of the mocked object is a subclass of the original
class. If the code calling this can know that the parameter is a mocked
object, then it can use the superclass instead. The code would have to be able
to call a method that returns true or false to indicate whether the instance is
a mocked object. Alternatively, a method that is defined to "return the
original class" of the instance could check for the Mockito-ness of the object
internally, and return the superclass instead of the class of the object.
I asked about this on the mailing list, and Szczepan said:
"There is no public API that could satisfy this. It could be added as a
new method to MockingDetails."
Original issue reported on code.google.com by davidmic...@gmail.com
on 9 May 2014 at 9:24
GoogleCodeExporter commented
By the way please use Github now when the PR is ready ;)
Thx David
Cheers
Brice
Original comment by brice.du...@gmail.com
on 27 Jun 2014 at 4:50
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
GoogleCodeExporter commented
And I'll be sending the pull request as soon as I figure out your process.
Original comment by davidmic...@gmail.com
on 30 Jun 2014 at 10:59
GoogleCodeExporter commented
ok :)
Original comment by brice.du...@gmail.com
on 1 Jul 2014 at 2:28