Sample project to demonstrate how to inject mock objects with robolectric
Java
Latest commit 4ee202a Sep 5, 2015 @fedepaol Updated readme
Permalink
Failed to load latest commit information.
app
gradle/wrapper
.gitignore Initial import, Sep 4, 2015
LICENSE Initial commit Sep 4, 2015
README.md
build.gradle Initial import, Sep 4, 2015
gradle.properties Initial import, Sep 4, 2015
gradlew Initial import, Sep 4, 2015
gradlew.bat Initial import, Sep 4, 2015
settings.gradle

README.md

RobolectricDependenyInjection

Sample project to demonstrate how to inject mock objects with robolectric

One really cool thing about robolectric 3.0 is the fact that you can override the Application object declared in your manifest with a custom one (which can inherit from your application's one).

If you are using dagger (or dagger 2) and you are using the application as the source of dependency injection for your classes, this allow to easily replace your injected objects with mocks. You can even choose which mocks inject in the setup phase of your tests.

More details can be found in this blogpost