use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class UserSearchQueryTest method searchForUsers_shouldSearchForUsersByLastUpdatedDateChanged.
@Test
public void searchForUsers_shouldSearchForUsersByLastUpdatedDateChanged() {
DateRangeParam lastUpdated = new DateRangeParam().setUpperBound(DATE_CHANGED).setLowerBound(DATE_CHANGED);
SearchParameterMap theParams = new SearchParameterMap().addParameter(COMMON_SEARCH_HANDLER, LAST_UPDATED_PROPERTY, lastUpdated);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(1));
List<Practitioner> resultList = get(results);
assertThat(resultList, hasSize(equalTo(1)));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class UserSearchQueryTest method searchForUsers_shouldReturnUsersByFamilyName.
@Test
public void searchForUsers_shouldReturnUsersByFamilyName() {
StringAndListParam familyName = new StringAndListParam().addAnd(new StringParam(USER_FAMILY_NAME));
SearchParameterMap theParams = new SearchParameterMap().addParameter(NAME_SEARCH_HANDLER, FAMILY_PROPERTY, familyName);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), greaterThanOrEqualTo(1));
List<Practitioner> resultList = get(results);
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList, everyItem(hasProperty("name", hasItem(hasProperty("family", equalTo(USER_FAMILY_NAME))))));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class UserSearchQueryTest method searchForUsers_shouldReturnUsersByMatchingGivenAndFamilyName.
@Test
public void searchForUsers_shouldReturnUsersByMatchingGivenAndFamilyName() {
StringAndListParam givenName = new StringAndListParam().addAnd(new StringParam(USER_GIVEN_NAME));
StringAndListParam familyName = new StringAndListParam().addAnd(new StringParam(USER_FAMILY_NAME));
SearchParameterMap theParams = new SearchParameterMap().addParameter(NAME_SEARCH_HANDLER, GIVEN_PROPERTY, givenName).addParameter(NAME_SEARCH_HANDLER, FAMILY_PROPERTY, familyName);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), greaterThanOrEqualTo(1));
List<Practitioner> resultList = get(results);
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList, everyItem(hasProperty("name", hasItem(hasProperty("given", hasItem(hasProperty("value", equalTo(USER_GIVEN_NAME))))))));
assertThat(resultList, everyItem(hasProperty("name", hasItem(hasProperty("family", equalTo(USER_FAMILY_NAME))))));
}
use of org.hl7.fhir.r4.model.Practitioner in project openmrs-module-fhir2 by openmrs.
the class UserSearchQueryTest method searchForUsers_shouldReturnEmptyCollectionByWrongCity.
@Test
public void searchForUsers_shouldReturnEmptyCollectionByWrongCity() {
StringAndListParam city = new StringAndListParam().addAnd(new StringParam(WRONG_CITY));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.ADDRESS_SEARCH_HANDLER, FhirConstants.CITY_PROPERTY, city);
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_shouldReturnUsersByCountry.
@Test
public void searchForUsers_shouldReturnUsersByCountry() {
StringAndListParam country = new StringAndListParam().addAnd(new StringParam(COUNTRY));
SearchParameterMap theParams = new SearchParameterMap().addParameter(ADDRESS_SEARCH_HANDLER, COUNTRY_PROPERTY, country);
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().getCountry(), equalTo(COUNTRY));
}
Aggregations