Android testing using Dagger 2, Mockito and a custom JUnit rule Dependency injection is a key concept to get testable code. Using dependency injection it’s easy to replace an object with a mock to change and verify the behavior of a system. Dagger 2 is the dependency injection library used in many Android projects, in this post we’ll see how to take advantage of it to test an Android app. Let’s se