Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #644 from opensrp/move-presenter-cleanup-to-ondestroy
Move presenter cleanup to ondestroy
- Loading branch information
Showing
2 changed files
with
58 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...d-json-form-wizard/src/test/java/com/vijay/jsonwizard/fragments/JsonFormFragmentTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.vijay.jsonwizard.fragments; | ||
|
||
|
||
import com.vijay.jsonwizard.BaseTest; | ||
import com.vijay.jsonwizard.presenters.JsonFormFragmentPresenter; | ||
|
||
import org.junit.Test; | ||
import org.mockito.Mock; | ||
import org.mockito.Mockito; | ||
|
||
public class JsonFormFragmentTest extends BaseTest { | ||
|
||
@Mock | ||
private JsonFormFragmentPresenter presenter; | ||
|
||
@Test | ||
public void testOnDestroyInvokesPresenterCleanUpAtleastOnce() { | ||
|
||
JsonFormFragment jsonFormFragment = Mockito.spy(new JsonFormFragment()); | ||
Mockito.doReturn(presenter).when(jsonFormFragment).getPresenter(); | ||
|
||
jsonFormFragment.onDestroy(); | ||
|
||
Mockito.verify(presenter, Mockito.atLeastOnce()).cleanUp(); | ||
|
||
} | ||
} |