Skip to content

Instantly share code, notes, and snippets.

@mreichelt
Last active June 7, 2016 07:36
Show Gist options
  • Save mreichelt/35d4e3afd8744aa75e8ecb84418c3f90 to your computer and use it in GitHub Desktop.
Save mreichelt/35d4e3afd8744aa75e8ecb84418c3f90 to your computer and use it in GitHub Desktop.
public class TestApp extends OurApp {
/** overrides method in OurApp that initializes our actual Dagger2 component */
@Override
protected void createComponents() {
OurTestComponent component = mock(OurTestComponent.class);
// required so our App init call works properly, which registers these callbacks
// WOAH, this is responsible for the memory leak!! But why?
when(component.activityLifecycleCallbacks())
.thenReturn(mock(activityLifecycleCallbacks));
OurApp.setComponent(component);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment