mardi 28 juin 2016

How to generate DaggerComponent class in the test/java folder?

I'm new to Dagger 2 and I'm working on using Dagger 2 for unit tests. I would like to test my presenter and mock some of the datasources(Server connection, SharedPreferences).
For the SharedPreferences I have SharedPreferencesComponent in the main folder and SharedPreferencesComponentFake in the test/java folder. The problem is that dagger can't generate DaggerSharedPreferencesComponentFake therefore I can't inject SharedPreferencesFake instead the SharedPreferences. How can i set up so dagger will generate the DaggerSharedPreferencesFake class , or am I using dagger 2 in the wrong way

Aucun commentaire:

Enregistrer un commentaire