diff --git a/gradle.properties b/gradle.properties index 6c340c68..33f0c0a4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=1.3.1-SNAPSHOT +VERSION_NAME=1.3.2-SNAPSHOT VERSION_CODE=1 GROUP=org.smartregister POM_SETTING_DESCRIPTION=OpenSRP Client Family Library diff --git a/opensrp-family/src/main/java/org/smartregister/family/presenter/BaseFamilyProfilePresenter.java b/opensrp-family/src/main/java/org/smartregister/family/presenter/BaseFamilyProfilePresenter.java index 3b2cc121..9cfbb370 100644 --- a/opensrp-family/src/main/java/org/smartregister/family/presenter/BaseFamilyProfilePresenter.java +++ b/opensrp-family/src/main/java/org/smartregister/family/presenter/BaseFamilyProfilePresenter.java @@ -8,6 +8,7 @@ import org.smartregister.commonregistry.CommonPersonObjectClient; import org.smartregister.domain.FetchStatus; import org.smartregister.family.R; +import org.smartregister.family.activity.BaseFamilyProfileActivity; import org.smartregister.family.contract.FamilyProfileContract; import org.smartregister.family.domain.FamilyEventClient; import org.smartregister.family.interactor.FamilyProfileInteractor; @@ -119,11 +120,11 @@ public void refreshProfileTopSection(CommonPersonObjectClient client) { if (Utils.getBooleanProperty(Constants.Properties.FAMILY_HEAD_FIRSTNAME_ENABLED)) { String familyHeadFirstName = Utils.getValue(client.getColumnmaps(), Constants.KEY.FAMILY_HEAD_NAME, true); - famName = getView().getApplicationContext().getString(R.string.family_profile_title_with_firstname, familyHeadFirstName, firstName); + famName = ((BaseFamilyProfileActivity) getView()).getString(R.string.family_profile_title_with_firstname, familyHeadFirstName, firstName); } else { - famName = getView().getApplicationContext().getString(R.string.family_profile_title, firstName); + famName = ((BaseFamilyProfileActivity) getView()).getString(R.string.family_profile_title, firstName); } getView().setProfileName(famName); diff --git a/opensrp-family/src/test/java/org/smartregister/family/presenter/BaseFamilyProfilePresenterTest.java b/opensrp-family/src/test/java/org/smartregister/family/presenter/BaseFamilyProfilePresenterTest.java index 694dd396..82d3258f 100644 --- a/opensrp-family/src/test/java/org/smartregister/family/presenter/BaseFamilyProfilePresenterTest.java +++ b/opensrp-family/src/test/java/org/smartregister/family/presenter/BaseFamilyProfilePresenterTest.java @@ -17,6 +17,7 @@ import org.smartregister.domain.FetchStatus; import org.smartregister.family.BaseUnitTest; import org.smartregister.family.R; +import org.smartregister.family.activity.BaseFamilyProfileActivity; import org.smartregister.family.contract.FamilyProfileContract; import org.smartregister.family.domain.FamilyEventClient; @@ -36,6 +37,9 @@ public class BaseFamilyProfilePresenterTest extends BaseUnitTest { @Mock private FamilyProfileContract.Interactor interactor; + @Mock + private BaseFamilyProfileActivity familyProfileActivity; + private Context context = RuntimeEnvironment.application; private String familyBaseEntityId = "familyBaseEntityId"; @@ -69,13 +73,14 @@ public void testRefreshProfileView() { @Test public void testRefreshProfileTopSection() { + BaseFamilyProfilePresenter mockPresenter = Mockito.spy(presenter); CommonPersonObjectClient client = Mockito.mock(CommonPersonObjectClient.class); Mockito.doReturn("12345").when(client).getCaseId(); - Mockito.doReturn(context).when(view).getApplicationContext(); + Mockito.doReturn(familyProfileActivity).when(mockPresenter).getView(); - presenter.refreshProfileTopSection(client); + mockPresenter.refreshProfileTopSection(client); - Mockito.verify(view).setProfileImage(client.getCaseId()); + Mockito.verify(familyProfileActivity).setProfileImage(client.getCaseId()); } @Test