Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using MockitoRule #96

Open
darrillaga opened this issue Jun 12, 2019 · 2 comments
Open

Using MockitoRule #96

darrillaga opened this issue Jun 12, 2019 · 2 comments

Comments

@darrillaga
Copy link

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

@fabioCollini
Copy link
Owner

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?

@darrillaga
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants