From c76a5135a33db367c5380659b91cf599648362c8 Mon Sep 17 00:00:00 2001 From: mherman22 Date: Sun, 21 Apr 2024 11:01:01 +0300 Subject: [PATCH] add concept.defaultConceptMapType GP for the value set translator test --- .../java/org/openmrs/module/fhir2/FhirConstants.java | 4 +++- .../translators/impl/ValueSetTranslatorImplTest.java | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/org/openmrs/module/fhir2/FhirConstants.java b/api/src/main/java/org/openmrs/module/fhir2/FhirConstants.java index 21f211dee..42a35c505 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/FhirConstants.java +++ b/api/src/main/java/org/openmrs/module/fhir2/FhirConstants.java @@ -182,7 +182,9 @@ private FhirConstants() { public static final String GLOBAL_PROPERTY_MODERATE = "allergy.concept.severity.moderate"; public static final String GLOBAL_PROPERTY_OTHER = "allergy.concept.severity.other"; - + + public static final String GLOBAL_PROPERTY_DEFAULT_CONCEPT_MAP_TYPE = "concept.defaultConceptMapType"; + public static final String GLOBAL_PROPERTY_URI_PREFIX = "fhir2.uriPrefix"; public static final String ENCOUNTER_REFERENCE_SEARCH_HANDLER = "encounter.reference.search.handler"; diff --git a/api/src/test/java/org/openmrs/module/fhir2/api/translators/impl/ValueSetTranslatorImplTest.java b/api/src/test/java/org/openmrs/module/fhir2/api/translators/impl/ValueSetTranslatorImplTest.java index 799406591..03a01aa1a 100644 --- a/api/src/test/java/org/openmrs/module/fhir2/api/translators/impl/ValueSetTranslatorImplTest.java +++ b/api/src/test/java/org/openmrs/module/fhir2/api/translators/impl/ValueSetTranslatorImplTest.java @@ -16,6 +16,7 @@ import static org.hamcrest.Matchers.notNullValue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.openmrs.module.fhir2.FhirConstants.GLOBAL_PROPERTY_DEFAULT_CONCEPT_MAP_TYPE; import java.util.ArrayList; import java.util.Collection; @@ -36,8 +37,10 @@ import org.openmrs.module.fhir2.FhirTestConstants; import org.openmrs.module.fhir2.TestFhirSpringConfiguration; import org.openmrs.module.fhir2.api.FhirConceptSourceService; +import org.openmrs.module.fhir2.api.FhirGlobalPropertyService; import org.openmrs.module.fhir2.model.FhirConceptSource; import org.openmrs.test.BaseModuleContextSensitiveTest; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; @ContextConfiguration(classes = TestFhirSpringConfiguration.class, inheritLocations = false) @@ -50,6 +53,9 @@ public class ValueSetTranslatorImplTest extends BaseModuleContextSensitiveTest { @Mock private Concept concept; + + @Autowired + private FhirGlobalPropertyService globalPropertyService; private final ValueSetTranslatorImpl valueSetTranslator = new ValueSetTranslatorImpl(); @@ -57,6 +63,11 @@ public class ValueSetTranslatorImplTest extends BaseModuleContextSensitiveTest { public void setup() { valueSetTranslator.setConceptSourceService(conceptSourceService); } + + @Before + public void setGlobalProperty() { + when(globalPropertyService.getGlobalProperty(GLOBAL_PROPERTY_DEFAULT_CONCEPT_MAP_TYPE)).thenReturn("NARROWER-THAN"); + } @Test public void shouldTranslateConceptSetToValueSet() {