use of ca.uhn.fhir.rest.param.StringOrListParam in project openmrs-module-fhir2 by openmrs.
the class LocationSearchQueryTest method searchForLocations_shouldReturnCorrectLocationByCity.
@Test
public void searchForLocations_shouldReturnCorrectLocationByCity() {
StringAndListParam city = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(LOCATION_CITY)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.CITY_SEARCH_HANDLER, city);
IBundleProvider locations = search(theParams);
assertThat(locations, notNullValue());
assertThat(locations.size(), equalTo(1));
List<Location> resultList = get(locations);
assertThat(resultList, hasSize(equalTo(1)));
assertThat(resultList.get(0).getAddress().getCity(), equalTo(LOCATION_CITY));
}
use of ca.uhn.fhir.rest.param.StringOrListParam in project openmrs-module-fhir2 by openmrs.
the class LocationSearchQueryTest method searchForLocations_shouldReturnEmptyCollectionWhenCalledWithUnknownCity.
@Test
public void searchForLocations_shouldReturnEmptyCollectionWhenCalledWithUnknownCity() {
StringAndListParam city = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(UNKNOWN_LOCATION_CITY)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.CITY_SEARCH_HANDLER, city);
IBundleProvider locations = search(theParams);
assertThat(locations, notNullValue());
assertThat(locations.size(), equalTo(0));
List<Location> resultList = get(locations);
assertThat(resultList, empty());
}
use of ca.uhn.fhir.rest.param.StringOrListParam in project openmrs-module-fhir2 by openmrs.
the class LocationSearchQueryTest method searchForLocations_shouldReturnEmptyCollectionWhenCalledWithUnknownCountry.
@Test
public void searchForLocations_shouldReturnEmptyCollectionWhenCalledWithUnknownCountry() {
StringAndListParam country = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(UNKNOWN_LOCATION_COUNTRY)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.COUNTRY_SEARCH_HANDLER, country);
IBundleProvider locations = search(theParams);
assertThat(locations, notNullValue());
assertThat(get(locations).size(), equalTo(0));
}
use of ca.uhn.fhir.rest.param.StringOrListParam in project openmrs-module-fhir2 by openmrs.
the class LocationSearchQueryTest method searchForLocations_shouldReturnCorrectLocationByCountry.
@Test
public void searchForLocations_shouldReturnCorrectLocationByCountry() {
StringAndListParam country = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(LOCATION_COUNTRY)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.COUNTRY_SEARCH_HANDLER, country);
IBundleProvider locations = search(theParams);
assertThat(locations, notNullValue());
assertThat(locations.size(), equalTo(2));
List<Location> resultList = get(locations);
assertThat(resultList, hasSize(equalTo(2)));
assertThat(resultList.get(0).getAddress().getCountry(), equalTo(LOCATION_COUNTRY));
}
use of ca.uhn.fhir.rest.param.StringOrListParam in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonSearchQueryTest method shouldReturnCollectionOfRelatedPeopleForMatchOnState.
@Test
public void shouldReturnCollectionOfRelatedPeopleForMatchOnState() {
StringAndListParam stringAndListParam = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(STATE)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.ADDRESS_SEARCH_HANDLER, FhirConstants.STATE_PROPERTY, stringAndListParam);
IBundleProvider relationships = search(theParams);
assertThat(relationships, notNullValue());
assertThat(relationships.size(), equalTo(1));
List<RelatedPerson> relationList = get(relationships);
assertThat(relationList, hasSize(equalTo(1)));
assertThat(relationList.get(0).getAddressFirstRep().getState(), equalTo(STATE));
}
Aggregations