Skip to content

Instantly share code, notes, and snippets.

@mreichelt
Last active June 7, 2016 07:36
Show Gist options
  • Select an option

  • Save mreichelt/35d4e3afd8744aa75e8ecb84418c3f90 to your computer and use it in GitHub Desktop.

Select an option

Save mreichelt/35d4e3afd8744aa75e8ecb84418c3f90 to your computer and use it in GitHub Desktop.

Revisions

  1. mreichelt revised this gist Jun 7, 2016. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions TestApp.java
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,10 @@ public class TestApp extends OurApp {
    @Override
    protected void createComponents() {
    OurTestComponent component = mock(OurTestComponent.class);
    // required so our init call in OurApp works properly, which registers these callbacks
    // 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));
    when(component.activityLifecycleCallbacks())
    .thenReturn(mock(activityLifecycleCallbacks));
    OurApp.setComponent(component);
    }

  2. mreichelt revised this gist Jun 6, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions TestApp.java
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ public class TestApp extends OurApp {
    protected void createComponents() {
    OurTestComponent component = mock(OurTestComponent.class);
    // required so our init call in OurApp 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);
    }
  3. mreichelt revised this gist Jun 6, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion TestApp.java
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    public class TestApp extends OurApp {

    /** overrides method in OurApp that implements the actual Dagger2 component */
    /** overrides method in OurApp that initializes our actual Dagger2 component */
    @Override
    protected void createComponents() {
    OurTestComponent component = mock(OurTestComponent.class);
  4. mreichelt created this gist Jun 6, 2016.
    12 changes: 12 additions & 0 deletions TestApp.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    public class TestApp extends OurApp {

    /** overrides method in OurApp that implements the actual Dagger2 component */
    @Override
    protected void createComponents() {
    OurTestComponent component = mock(OurTestComponent.class);
    // required so our init call in OurApp works properly, which registers these callbacks
    when(component.activityLifecycleCallbacks()).thenReturn(mock(activityLifecycleCallbacks));
    OurApp.setComponent(component);
    }

    }