mockito-collections
mockito-collections copied to clipboard
@Spy vs. @Mock
In a scenario where one might use Spring to Inject a Collection of all implementations of a certain Interface, I've found that I can use @Mock to inject multiple instances, but @Spy didn't work (Collection<MyInerface> was null).
Is this supported by Mockito Collections or am I doing something wrong? If not supported I would be interested in adding this to this project.
Sounds sensible, this isn't something that's currently supported. If you would like to add this yourself, feel free to submit a pull request. I think this should be a relatively trivial change, the harder part will be providing tests for the various scenarios. I'm not too happy with the current integration test module, but ideally there should be something within the integration tests to cover this.