-
Hi, until now, I was using Mockito and changed recently to mockk. I know that Mockito and mockk differs in the way they mock construction of objects. But in Mockito I was able to get the number of mocks that were constructed under the effect of a MockedConstruction. I haven't find out how I can achieve this using mockkConstructor. Is this possible and how (without altering the code that needs to be tested)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Short answer: no, it currently isn't possible. However, it may be possible if the ConstructionInvocationHandler in JvmConstructionMockFactory kept track of when it was called and then the public API exposed a method to get the invocation count by class. This seems like a useful feature, I'd be more than happy to review a PR about it! |
Beta Was this translation helpful? Give feedback.
Short answer: no, it currently isn't possible.
However, it may be possible if the ConstructionInvocationHandler in JvmConstructionMockFactory kept track of when it was called and then the public API exposed a method to get the invocation count by class.
This seems like a useful feature, I'd be more than happy to review a PR about it!