How to mock Dagger object object diagrams?

I use Dagger in an Android application to provide graphs of application areas and activity. And I use Robolectric for unit testing. I know that I can provide Robolectric a replacement Application class that is configured with an application object graph that overrides the real one with mocks. But I don’t understand how to do the same with activity object graphs, since the standard template for activity object graphs is intended for the actions themselves to create an instance of the Dagger tool module they need. Any suggestions would be greatly appreciated.

+4
source share
1 answer

Please take a look at my project - https://github.com/emartynov/UrlSetter

You will find how I managed to use mocks with tags DaggerinRobolectric

+2
source

All Articles