title: Injecting mock Retrofit API service instance into ActivityInstrumentTestCase2
body: <p>I'd like to write functional tests with Espresso for an Activity using a mock Retrofit API service instance created with a MockRestAdapter (<a href="https://github.com/square/retrofit/blob/master/retrofit-mock/src/main/java/retrofit/MockRestAdapter.java" rel="nofollow">https://github.com/square/retrofit/blob/master/retrofit-mock/src/main/java/retrofit/MockRestAdapter.java</a>).</p>
  
  <p>This is a bit tricky though, as you can't really ever inject any dependencies via the Activity's constructor.</p>
  
  <p>Currently, a single Retrofit API service instance lives in my Application object, and I create a reference to it in each of my Activities' <code>onCreate()</code> methods.</p>
  
  <p>How can I swap in a mock Retrofit API service? Perhaps Dagger is the answer?</p>