use of org.openmrs.module.fhir2.api.translators.LocationTranslator in project openmrs-module-fhir2 by openmrs.
the class FhirLocationServiceImplTest method searchForLocations_shouldReturnLocationsByParameters.
@Test
public void searchForLocations_shouldReturnLocationsByParameters() {
List<org.openmrs.Location> locations = new ArrayList<>();
locations.add(location);
SearchParameterMap theParams = new SearchParameterMap();
when(locationDao.getSearchResultUuids(any())).thenReturn(Collections.singletonList(LOCATION_UUID));
when(searchQuery.getQueryResults(any(), any(), any(), any())).thenReturn(new SearchQueryBundleProvider<>(theParams, locationDao, locationTranslator, globalPropertyService, searchQueryInclude));
when(searchQueryInclude.getIncludedResources(any(), any())).thenReturn(Collections.emptySet());
when(locationTranslator.toFhirResource(location)).thenReturn(fhirLocation);
when(locationDao.getSearchResults(any(), any())).thenReturn(locations);
IBundleProvider results = fhirLocationService.searchForLocations(null, null, null, null, null, null, null, null, null, null, null, null);
assertThat(results, notNullValue());
List<Location> resultList = get(results);
assertThat(resultList, not(empty()));
assertThat(resultList, hasItem(hasProperty("id", equalTo(LOCATION_UUID))));
}
Aggregations