Skip to content

Instantly share code, notes, and snippets.

@ralphpina
Created February 16, 2017 20:06
Show Gist options
  • Save ralphpina/245e7e7fe0c1761de0f3275ae8875eb5 to your computer and use it in GitHub Desktop.
Save ralphpina/245e7e7fe0c1761de0f3275ae8875eb5 to your computer and use it in GitHub Desktop.
injecting application component into the Application subclass
// Needed to replace the component with a test specific one
@VisibleForTesting
public void setComponent(ApplicationComponent applicationComponent) {
this.applicationComponent = applicationComponent;
// we need to inject again, otherwise the objects here are the originals
// not the test ones as one would expect R.Pina 20160105
this.applicationComponent.inject(this);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment