forked from Raxa/raxacore
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Martina, Roni, Eyal, Klaus | BAH-460 | add api to search patients wit…
…h similar name, gender and birthdate/age
- Loading branch information
Showing
11 changed files
with
384 additions
and
59 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
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
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
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
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
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
46 changes: 46 additions & 0 deletions
46
.../test/java/org/bahmni/module/bahmnicore/contract/patient/PatientSearchParametersTest.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,46 @@ | ||
package org.bahmni.module.bahmnicore.contract.patient; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mockito.Mock; | ||
import org.openmrs.module.webservices.rest.web.RequestContext; | ||
|
||
import javax.servlet.http.HttpServletRequest; | ||
import java.sql.Timestamp; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNull; | ||
import static org.mockito.Mockito.when; | ||
import static org.mockito.MockitoAnnotations.initMocks; | ||
|
||
|
||
public class PatientSearchParametersTest { | ||
|
||
@Mock | ||
RequestContext requestContext; | ||
|
||
@Mock | ||
HttpServletRequest request; | ||
|
||
@Before | ||
public void setup() { | ||
initMocks(this); | ||
when(requestContext.getRequest()).thenReturn(request); | ||
} | ||
|
||
@Test | ||
public void shouldIgnoreEmptyBirthdate () { | ||
when(requestContext.getParameter("birthdate")).thenReturn(""); | ||
PatientSearchParameters patientSearchParameters = new PatientSearchParameters(requestContext); | ||
|
||
assertNull(patientSearchParameters.getBirthdate()); | ||
} | ||
|
||
@Test | ||
public void shouldParseBirthdateFromStringAndSetToMidnight () { | ||
when(requestContext.getParameter("birthdate")).thenReturn("1983-01-30"); | ||
PatientSearchParameters patientSearchParameters = new PatientSearchParameters(requestContext); | ||
|
||
assertEquals(Timestamp.valueOf("1983-01-30 00:00:00"), patientSearchParameters.getBirthdate()); | ||
} | ||
} |
Oops, something went wrong.