diff --git a/api/src/test/java/org/openmrs/module/fhir2/api/search/PatientSearchQueryTest.java b/api/src/test/java/org/openmrs/module/fhir2/api/search/PatientSearchQueryTest.java index 39477c348..61fe995e8 100644 --- a/api/src/test/java/org/openmrs/module/fhir2/api/search/PatientSearchQueryTest.java +++ b/api/src/test/java/org/openmrs/module/fhir2/api/search/PatientSearchQueryTest.java @@ -9,34 +9,6 @@ */ package org.openmrs.module.fhir2.api.search; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.allOf; -import static org.hamcrest.Matchers.anyOf; -import static org.hamcrest.Matchers.empty; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.everyItem; -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.hamcrest.Matchers.hasItem; -import static org.hamcrest.Matchers.hasProperty; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.instanceOf; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.lessThanOrEqualTo; -import static org.hamcrest.Matchers.not; -import static org.hamcrest.Matchers.notNullValue; -import static org.hamcrest.Matchers.startsWith; -import static org.hl7.fhir.r4.model.Patient.SP_FAMILY; -import static org.hl7.fhir.r4.model.Patient.SP_GIVEN; -import static org.mockito.Mockito.when; -import static org.openmrs.module.fhir2.matchers.FhirMatchers.isDeceased; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.rest.api.SortOrderEnum; import ca.uhn.fhir.rest.api.SortSpec; @@ -58,6 +30,7 @@ import org.hl7.fhir.r4.model.ServiceRequest; import org.junit.Before; import org.junit.Test; +import org.openmrs.api.AdministrationService; import org.openmrs.module.fhir2.FhirConstants; import org.openmrs.module.fhir2.TestFhirSpringConfiguration; import org.openmrs.module.fhir2.api.FhirGlobalPropertyService; @@ -66,8 +39,36 @@ import org.openmrs.module.fhir2.api.translators.PatientTranslator; import org.openmrs.test.BaseModuleContextSensitiveTest; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.ContextConfiguration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.anyOf; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.everyItem; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.hamcrest.Matchers.hasItem; +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.instanceOf; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.lessThanOrEqualTo; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.Matchers.startsWith; +import static org.hl7.fhir.r4.model.Patient.SP_FAMILY; +import static org.hl7.fhir.r4.model.Patient.SP_GIVEN; +import static org.openmrs.module.fhir2.matchers.FhirMatchers.isDeceased; + @ContextConfiguration(classes = TestFhirSpringConfiguration.class, inheritLocations = false) public class PatientSearchQueryTest extends BaseModuleContextSensitiveTest { @@ -150,6 +151,10 @@ public class PatientSearchQueryTest extends BaseModuleContextSensitiveTest { @Autowired private FhirGlobalPropertyService globalPropertyService; + + @Autowired + @Qualifier("adminService") + private AdministrationService administrationService; @Autowired private SearchQuery> searchQuery; @@ -161,15 +166,6 @@ public void setup() throws Exception { } } - @Before - public void setupMocks() { - SEVERITY_CONCEPT_UUIDS.put(FhirConstants.GLOBAL_PROPERTY_SEVERE, SEVERITY_SEVERE_CONCEPT_UUID); - - when(globalPropertyService.getGlobalProperties(FhirConstants.GLOBAL_PROPERTY_MILD, - FhirConstants.GLOBAL_PROPERTY_MODERATE, FhirConstants.GLOBAL_PROPERTY_SEVERE, - FhirConstants.GLOBAL_PROPERTY_OTHER)).thenReturn(SEVERITY_CONCEPT_UUIDS); - } - private IBundleProvider search(SearchParameterMap theParams) { return searchQuery.getQueryResults(theParams, dao, translator, searchQueryInclude); }