Android functional testing with Dagger
I’m trying to test an Activity with Mockito & Dagger . I have been able to inject dependencies to Activity in my application but when testing the Activity, I have not been able to inject mock to the Activity. Should I inject Activity to test or let getActivity() create it? public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> { @Inject Engine engineMock; private MainActivity mActivity; private Button mLogoutBtn; public MainActivityTest() { super(MainActivity.class); } @Override protected void setUp() throws Exception { super.setUp(); // Inject engineMock to test