Skip to content

Commit

Permalink
(test) add more patient dao tests
Browse files Browse the repository at this point in the history
  • Loading branch information
icrc-jofrancisco committed Jul 19, 2024
1 parent 4c35de8 commit 055c60d
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package org.openmrs.module.fhir2.api.dao.impl;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
Expand Down Expand Up @@ -39,6 +40,8 @@ public class FhirPatientDaoImplTest extends BaseModuleContextSensitiveTest {

private static final String GROUP_A = "dfb29c44-2e39-46c4-8cd7-18f21c6d47b1";

private static final String GROUP_B = "a25ce1d7-326c-43ff-a87f-63d9d2f60f11";

private static final String PATIENT_GROUP_A = "61b38324-e2fd-4feb-95b7-9e9a2a4400df";

private static final String[] PATIENT_SEARCH_DATA_FILES = {
Expand Down Expand Up @@ -104,4 +107,16 @@ public void getSearchResults_shouldReturnPatientSearchResults() {
assertThat(result, notNullValue());
assertThat(result.get(0).getUuid(), equalTo(PATIENT_GROUP_A));
}

@Test
public void getSearchResults_shouldReturnEmptyList() {
HasAndListParam groupParam = new HasAndListParam().addAnd(
new HasOrListParam().add(new HasParam(FhirConstants.GROUP, FhirConstants.INCLUDE_MEMBER_PARAM, "id", GROUP_B)));

SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.HAS_SEARCH_HANDLER, groupParam);
List<Patient> result = dao.getSearchResults(theParams);

assertThat(result, notNullValue());
assertThat(result, empty());
}
}

0 comments on commit 055c60d

Please sign in to comment.