DaggerMock
DaggerMock copied to clipboard
Using MockitoRule
Hi I've been looking for something like this library for a long time, this is awesome!.
Currently I create TestModules full of mock(X.class) replicating the dependencies I need from real graph, I'm doing that for AndroidJunit4 tests with androidX libraries and Robolectric.
The thing is I would like to mix this with the MockitoJUnit Rule, that creates a mock sessions and does proper clean up after tests finishes, do you have something in mind for that integration?
https://static.javadoc.io/org.mockito/mockito-core/2.8.47/org/mockito/junit/MockitoRule.html
Thanks, glad you like it!
Can you explain better what you want to achieve? Can't you just create an additional MockitoJUnit in the test?
Looking at the code here, the mocks are being created on the internal logic using Mockito.mock() method, right? The thing is to get the advantages of the Mockito Rule and the session it creates the mocks has to be created by the rule.
So ideally there should be a way to get a Mockito session (what the rule uses inside) tracking all the mocks your library creates to allow them to being cleaned up by Mockito and use the advantages they added