Skip to content

Instantly share code, notes, and snippets.

@catehstn
Created April 25, 2016 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save catehstn/7068675fda95b0fb6a375fddbd31c8b2 to your computer and use it in GitHub Desktop.
Save catehstn/7068675fda95b0fb6a375fddbd31c8b2 to your computer and use it in GitHub Desktop.
private static class HomeActivityTestRule extends IntentsTestRule {
private HomeActivityTestRule() {
super(HomeActivity.class);
}
@Override public void beforeActivityLaunched() {
Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
ShowAndHideApplication app =
(ShowAndHideApplication) instrumentation.getTargetContext().getApplicationContext();
ShowAndHideTestComponent component = DaggerShowAndHideTestComponent.builder()
.mockFileUtilitiesModule(new MockFileUtilitiesModule())
.mockImageProcessorModule(new MockImageProcessorModule())
.build();
app.setComponent(component);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment