use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonSearchQueryTest method shouldReturnCollectionOfRelatedPeopleByLastUpdatedDateCreated.
@Test
public void shouldReturnCollectionOfRelatedPeopleByLastUpdatedDateCreated() {
DateRangeParam lastUpdated = new DateRangeParam().setUpperBound(DATE_CREATED).setLowerBound(DATE_CREATED);
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.COMMON_SEARCH_HANDLER, FhirConstants.LAST_UPDATED_PROPERTY, lastUpdated);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(2));
List<RelatedPerson> resultList = get(results);
assertThat(resultList.size(), equalTo(2));
}
use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonSearchQueryTest method shouldReturnCollectionOfRelatedPeopleByLastUpdatedDateChanged.
@Test
public void shouldReturnCollectionOfRelatedPeopleByLastUpdatedDateChanged() {
DateRangeParam lastUpdated = new DateRangeParam().setUpperBound(DATE_CHANGED).setLowerBound(DATE_CHANGED);
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.COMMON_SEARCH_HANDLER, FhirConstants.LAST_UPDATED_PROPERTY, lastUpdated);
IBundleProvider results = search(theParams);
List<RelatedPerson> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList, not(empty()));
assertThat(resultList, hasSize(equalTo(1)));
}
use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonSearchQueryTest method shouldReturnCollectionOfRelatedPeopleForMatchOnCountry.
@Test
public void shouldReturnCollectionOfRelatedPeopleForMatchOnCountry() {
StringAndListParam stringAndListParam = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(COUNTRY)));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.ADDRESS_SEARCH_HANDLER, FhirConstants.COUNTRY_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().getCountry(), equalTo(COUNTRY));
}
use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonSearchQueryTest method shouldReturnEmptyCollectionForNoMatchOnGender.
@Test
public void shouldReturnEmptyCollectionForNoMatchOnGender() {
TokenAndListParam tokenAndListParam = new TokenAndListParam().addAnd(new TokenOrListParam().add(WRONG_GENDER));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.GENDER_SEARCH_HANDLER, tokenAndListParam);
IBundleProvider relationships = search(theParams);
assertThat(relationships, notNullValue());
assertThat(relationships.size(), equalTo(0));
List<RelatedPerson> relationList = get(relationships);
assertThat(relationList, is(empty()));
}
use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonSearchQueryTest method shouldReturnCollectionOfRelatedPeopleByUuid.
@Test
public void shouldReturnCollectionOfRelatedPeopleByUuid() {
TokenAndListParam uuid = new TokenAndListParam().addAnd(new TokenParam(RELATIONSHIP_UUID));
SearchParameterMap theParams = new SearchParameterMap().addParameter(FhirConstants.COMMON_SEARCH_HANDLER, FhirConstants.ID_PROPERTY, uuid);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), equalTo(1));
List<RelatedPerson> resultList = get(results);
assertThat(resultList, hasSize(equalTo(1)));
assertThat(resultList.get(0).getIdElement().getIdPart(), equalTo(RELATIONSHIP_UUID));
}
Aggregations