Skip to content

Commit

Permalink
Increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
hamza-vd committed Dec 10, 2020
1 parent 66431f5 commit d207f40
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"));
}

}

0 comments on commit d207f40

Please sign in to comment.