use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method searchLocations_shouldReturnMatchingBundleOfChainedLocationsByParentCity.
@Test
public void searchLocations_shouldReturnMatchingBundleOfChainedLocationsByParentCity() {
ReferenceAndListParam locationParentCity = new ReferenceAndListParam();
locationParentCity.addValue(new ReferenceOrListParam().add(new ReferenceParam().setValue("kampala").setChain(Location.SP_ADDRESS_CITY)));
when(locationService.searchForLocations(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), argThat(Matchers.is(locationParentCity)), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(location), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchLocations(null, null, null, null, null, null, locationParentCity, null, null, null, null, null);
List<Location> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.get(0).fhirType(), is(FhirConstants.LOCATION));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
}
use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method getLocationByUuid_shouldReturnMatchingLocation.
@Test
public void getLocationByUuid_shouldReturnMatchingLocation() {
when(locationService.get(LOCATION_UUID)).thenReturn(location);
IdType id = new IdType();
id.setValue(LOCATION_UUID);
org.hl7.fhir.dstu3.model.Location result = resourceProvider.getLocationById(id);
assertThat(result, notNullValue());
assertThat(result.getId(), notNullValue());
assertThat(result.getId(), equalTo(LOCATION_UUID));
}
use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method searchLocations_shouldReturnMatchingBundleOfLocations.
@Test
public void searchLocations_shouldReturnMatchingBundleOfLocations() {
List<org.hl7.fhir.r4.model.Location> locations = new ArrayList<>();
locations.add(location);
when(locationService.searchForLocations(any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(new MockIBundleProvider<>(locations, PREFERRED_PAGE_SIZE, COUNT));
StringAndListParam location = new StringAndListParam().addAnd(new StringOrListParam().add(new StringParam(LOCATION_NAME)));
IBundleProvider results = resourceProvider.searchLocations(location, null, null, null, null, null, null, null, null, null, null, null);
List<Location> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.get(0).fhirType(), is(FhirConstants.LOCATION));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getId(), equalTo(LOCATION_UUID));
}
use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method searchLocations_shouldReturnMatchingBundleOfLocationsByLastUpdated.
@Test
public void searchLocations_shouldReturnMatchingBundleOfLocationsByLastUpdated() {
DateRangeParam lastUpdated = new DateRangeParam().setUpperBound(LAST_UPDATED_DATE).setLowerBound(LAST_UPDATED_DATE);
when(locationService.searchForLocations(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), argThat(is(lastUpdated)), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(location), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchLocations(null, null, null, null, null, null, null, null, lastUpdated, null, null, null);
List<Location> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.get(0).fhirType(), is(FhirConstants.LOCATION));
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getId(), equalTo(LOCATION_UUID));
}
use of com.ibm.watson.compare_comply.v1.model.Location in project openmrs-module-fhir2 by openmrs.
the class LocationFhirResourceProviderTest method searchLocations_shouldNotAddRelatedResourcesForEmptyReverseInclude.
@Test
public void searchLocations_shouldNotAddRelatedResourcesForEmptyReverseInclude() {
HashSet<Include> revIncludeSet = new HashSet<>();
when(locationService.searchForLocations(isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull(), isNull())).thenReturn(new MockIBundleProvider<>(Collections.singletonList(location), PREFERRED_PAGE_SIZE, COUNT));
IBundleProvider results = resourceProvider.searchLocations(null, null, null, null, null, null, null, null, null, null, revIncludeSet, null);
List<Location> resultList = get(results);
assertThat(results, notNullValue());
assertThat(resultList.get(0).fhirType(), is(FhirConstants.LOCATION));
assertThat(resultList.size(), equalTo(1));
assertThat(resultList.get(0).getId(), equalTo(LOCATION_UUID));
}
Aggregations