-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
3 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
47 changes: 47 additions & 0 deletions
47
opensrp-chw-anc/src/test/java/org/smartregister/chw/anc/util/NCUtilsTest.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,47 @@ | ||
package org.smartregister.chw.anc.util; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.smartregister.chw.anc.domain.VisitDetail; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class NCUtilsTest { | ||
|
||
@Test | ||
public void testGetText() { | ||
List<VisitDetail> details = new ArrayList<>(); | ||
|
||
VisitDetail visitDetail1 = new VisitDetail(); | ||
visitDetail1.setHumanReadable("test1"); | ||
details.add(visitDetail1); | ||
|
||
VisitDetail visitDetail2 = new VisitDetail(); | ||
visitDetail2.setHumanReadable("test2"); | ||
details.add(visitDetail2); | ||
|
||
VisitDetail visitDetail3 = new VisitDetail(); | ||
details.add(visitDetail3); | ||
|
||
details.add(null); | ||
|
||
String val = NCUtils.getText(details).trim(); | ||
String expected = "test1, test2"; | ||
|
||
Assert.assertEquals(expected, val); | ||
} | ||
|
||
@Test | ||
public void testGetTextOneParam() { | ||
|
||
VisitDetail visitDetail1 = new VisitDetail(); | ||
visitDetail1.setHumanReadable("test1"); | ||
|
||
String val = NCUtils.getText(visitDetail1).trim(); | ||
String expected = "test1"; | ||
|
||
Assert.assertEquals(expected, val); | ||
} | ||
|
||
} |
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