Skip to content

Instantly share code, notes, and snippets.

@mreichelt
Created June 6, 2016 23:27
Show Gist options
  • Save mreichelt/15316b926cb66b3e9939d4f6d087cbfd to your computer and use it in GitHub Desktop.
Save mreichelt/15316b926cb66b3e9939d4f6d087cbfd to your computer and use it in GitHub Desktop.
public class TestApp extends OurApp {
@Override
protected void createComponents() {
OurTestComponent component = mock(OurTestComponent.class);
// fixed the memory leak by using a plain stub (without invocation tracking)
OurActivityLifecycleCallbacks callbacks =
mock(OurActivityLifecycleCallbacks.class, withSettings().stubOnly());
when(component.activityLifecycleCallbacks()).thenReturn(mock(callbacks));
OurApp.setComponent(component);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment