Created
November 29, 2017 01:12
-
-
Save larkintuckerllc/58a996c78bf82f49842e27bfc702671a to your computer and use it in GitHub Desktop.
How-to Dagger 2 with Android: Part 2 - 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@RunWith(AndroidJUnit4.class) | |
@LargeTest | |
public class MainActivityTest { | |
@Rule | |
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class) { | |
@Override | |
protected void beforeActivityLaunched() { | |
MyApplication application = (MyApplication) InstrumentationRegistry | |
.getInstrumentation() | |
.getTargetContext() | |
.getApplicationContext(); | |
MyComponent myComponent = DaggerMyComponentMock | |
.builder() | |
.myModuleMock(new MyModuleMock()) | |
.build(); | |
application.setMyComponent(myComponent); | |
} | |
}; | |
@Test | |
public void formattedDateShown() { | |
onView(withId(R.id.tvDate)).check(matches(withText("Wed Dec 31 19:00:00 EST 1969"))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment