use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonFhirResourceProviderTest method searchForPeople_shouldReturnMatchingBundleOfPeopleByGender.
@Test
public void searchForPeople_shouldReturnMatchingBundleOfPeopleByGender() {
TokenAndListParam genderParam = new TokenAndListParam().addAnd(new TokenOrListParam().add(GENDER));
when(relatedPersonService.searchForRelatedPeople(isNull(), argThat(is(genderParam)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(relatedPerson), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchRelatedPerson(null, genderParam, null, null, null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, Matchers.notNullValue());
assertThat(resultList.iterator().next().fhirType(), equalTo(FhirConstants.RELATED_PERSON));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonFhirResourceProviderTest method searchForRelatedPeople_shouldReturnMatchingBundleOfRelatedPeopleByCity.
@Test
public void searchForRelatedPeople_shouldReturnMatchingBundleOfRelatedPeopleByCity() {
StringAndListParam cityParam = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(CITY)));
when(relatedPersonService.searchForRelatedPeople(isNull(), isNull(), isNull(), argThat(is(cityParam)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(relatedPerson), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchRelatedPerson(null, null, null, cityParam, null, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, Matchers.notNullValue());
assertThat(resultList.iterator().next().fhirType(), equalTo(FhirConstants.RELATED_PERSON));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonFhirResourceProviderTest method searchForRelatedPeople_shouldReturnMatchingBundleOfRelatedPeopleByCountry.
@Test
public void searchForRelatedPeople_shouldReturnMatchingBundleOfRelatedPeopleByCountry() {
StringAndListParam countryParam = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(COUNTRY)));
when(relatedPersonService.searchForRelatedPeople(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), argThat(is(countryParam)), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(relatedPerson), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchRelatedPerson(null, null, null, null, null, null, countryParam, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, Matchers.notNullValue());
assertThat(resultList.iterator().next().fhirType(), equalTo(FhirConstants.RELATED_PERSON));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonFhirResourceProviderTest method searchForRelatedPeople_shouldReturnMatchingBundleOfRelatedPeopleByLastUpdated.
@Test
public void searchForRelatedPeople_shouldReturnMatchingBundleOfRelatedPeopleByLastUpdated() {
DateRangeParam lastUpdated = new DateRangeParam().setLowerBound(LAST_UPDATED_DATE).setUpperBound(LAST_UPDATED_DATE);
when(relatedPersonService.searchForRelatedPeople(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), argThat(is(lastUpdated)), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(relatedPerson), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchRelatedPerson(null, null, null, null, null, null, null, null, lastUpdated, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, Matchers.notNullValue());
assertThat(resultList.iterator().next().fhirType(), equalTo(FhirConstants.RELATED_PERSON));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of org.hl7.fhir.r4.model.RelatedPerson in project openmrs-module-fhir2 by openmrs.
the class RelatedPersonFhirResourceProviderTest method searchForRelatedPeople_shouldReturnMatchingBundleOfRelatedPeopleByState.
@Test
public void searchForRelatedPeople_shouldReturnMatchingBundleOfRelatedPeopleByState() {
StringAndListParam stateParam = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(STATE)));
when(relatedPersonService.searchForRelatedPeople(isNull(), isNull(), isNull(), isNull(), argThat(is(stateParam)), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(relatedPerson), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchRelatedPerson(null, null, null, null, stateParam, null, null, null, null, null, null);
List<IBaseResource> resultList = get(results);
assertThat(results, Matchers.notNullValue());
assertThat(resultList.iterator().next().fhirType(), equalTo(FhirConstants.RELATED_PERSON));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
Aggregations