use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class PractitionerSearchQueryTest method searchForPractitioners_shouldReturnPractitionersByState.
@Test
public void searchForPractitioners_shouldReturnPractitionersByState() {
StringAndListParam state = new StringAndListParam().addAnd(new StringParam(STATE));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.ADDRESS_SEARCH_HANDLER, FhirConstants.STATE_PROPERTY, state);
IBundleProvider results = search(theParams);
List<IBaseResource> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(equalTo(1)));
assertThat(((Practitioner) resultList.iterator().next()).getAddressFirstRep().getState(), equalTo(STATE));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class UserSearchQueryTest method searchForUsers_shouldReturnEmptyCollectionWhenNameNotMatched.
@Test
public void searchForUsers_shouldReturnEmptyCollectionWhenNameNotMatched() {
StringAndListParam name = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(NOT_FOUND_USER_NAME)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.NAME_SEARCH_HANDLER, FhirConstants.NAME_PROPERTY, name);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(0));
List<Practitioner> resultList = get(results);
assertThat(resultList, is(empty()));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class UserSearchQueryTest method searchForUsers_shouldReturnEmptyCollectionByWrongState.
@Test
public void searchForUsers_shouldReturnEmptyCollectionByWrongState() {
StringAndListParam state = new StringAndListParam().addAnd(new StringParam(WRONG_STATE));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.ADDRESS_SEARCH_HANDLER, FhirConstants.STATE_PROPERTY, state);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(0));
List<Practitioner> resultList = get(results);
assertThat(resultList, empty());
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class UserSearchQueryTest method searchForUsers_shouldReturnEmptyCollectionForMismatchingGivenAndFamilyName.
@Test
public void searchForUsers_shouldReturnEmptyCollectionForMismatchingGivenAndFamilyName() {
StringAndListParam givenName = new StringAndListParam().addAnd(new StringParam(WRONG_GIVEN_NAME));
StringAndListParam familyName = new StringAndListParam().addAnd(new StringParam(USER_FAMILY_NAME));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.NAME_SEARCH_HANDLER, FhirConstants.GIVEN_PROPERTY, givenName).addParameter(FhirConstants.NAME_SEARCH_HANDLER, FhirConstants.FAMILY_PROPERTY, familyName);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(0));
List<Practitioner> resultList = get(results);
assertThat(resultList, empty());
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class UserSearchQueryTest method searchForUsers_shouldReturnUsersByState.
@Test
public void searchForUsers_shouldReturnUsersByState() {
StringAndListParam state = new StringAndListParam().addAnd(new StringParam(STATE));
SearchParameterMap theParams = new SearchParameterMap().addParameter(ADDRESS_SEARCH_HANDLER, STATE_PROPERTY, state);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), greaterThanOrEqualTo(1));
List<Practitioner> resultList = get(results);
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getAddressFirstRep().getState(), equalTo(STATE));
}
Aggregations