diff --git a/opensrp-chw-family-planning/src/test/java/org/smartregister/chw/fp/util/FpUtilTest.java b/opensrp-chw-family-planning/src/test/java/org/smartregister/chw/fp/util/FpUtilTest.java new file mode 100644 index 0000000..4e3be4e --- /dev/null +++ b/opensrp-chw-family-planning/src/test/java/org/smartregister/chw/fp/util/FpUtilTest.java @@ -0,0 +1,27 @@ +package org.smartregister.chw.fp.util; + +import android.content.Context; +import android.content.res.Resources; + +import org.junit.Assert; +import org.junit.Test; +import org.mockito.Mockito; +import org.smartregister.fp.R; + +public class FpUtilTest { + + + @Test + public void testGetGender() { + Context context = Mockito.mock(Context.class); + Resources resources = Mockito.mock(Resources.class); +// + Mockito.doReturn(resources).when(context).getResources(); + Mockito.doReturn("Male").when(resources).getString(R.string.male); + Mockito.doReturn("Female").when(resources).getString(R.string.female); + + Assert.assertEquals("Male", FpUtil.getGenderTranslated(context, "male")); + Assert.assertEquals("Female", FpUtil.getGenderTranslated(context, "female")); + } + +}