@@ -127,6 +127,46 @@ void When_MappingCodeableConceptWithNonSnomedCodeSystems_Expect_ManifestedXmlCon
127127 assertThat (outputMessageXml ).isEqualToIgnoringWhitespace (expectedOutputXml );
128128 }
129129
130+
131+ @ Test
132+ void When_mapToNullFlavorCodeableConceptForAllergyWithoutSnomedCode_ExpectOriginalTextIsNotPresent () {
133+ var inputJson = """
134+ {
135+ "resourceType": "AllergyIntolerance",
136+ "id": "0C1232CF-D34B-4C16-A5F4-0F6461C51A41",
137+ "meta": {
138+ "profile": [
139+ "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-AllergyIntolerance-1"
140+ ]
141+ },
142+ "identifier": [
143+ {
144+ "system": "https://EMISWeb/A82038",
145+ "value": "55D2363D57A248F49A745B2E03F5E93D0C1232CFD34B4C16A5F40F6461C51A41"
146+ }
147+ ],
148+ "code": {
149+ "coding": [
150+ {
151+ "system": "http://read.info/readv2",
152+ "code": "TJ00800",
153+ "display": "Adverse reaction to pivampicillin rt"
154+ }
155+ ],
156+ "text": "Adverse reaction to pivampicillin"
157+ }
158+ }""" ;
159+ var expectedOutputXML = """
160+ <code nullFlavor="UNK">
161+ </code>
162+ """ ;
163+ var codeableConcept = fhirParseService .parseResource (inputJson , AllergyIntolerance .class ).getCode ();
164+
165+ var outputXml = codeableConceptCdMapper .mapToNullFlavorCodeableConceptForAllergy (codeableConcept , AllergyIntolerance .AllergyIntoleranceClinicalStatus .ACTIVE );
166+
167+ assertThat (outputXml ).isEqualToIgnoringWhitespace (expectedOutputXML );
168+ }
169+
130170 @ ParameterizedTest
131171 @ MethodSource ("getTestArgumentsActualProblem" )
132172 public void When_MappingStubbedCodeableConceptForActualProblemHeader_Expect_HL7CdObjectXml (String inputJson , String outputXml )
@@ -271,4 +311,5 @@ public void When_MapToCdForMedication_With_RelatedProblemAndTitle_Expect_Concept
271311
272312 assertThat (outputString ).isEqualToIgnoringWhitespace (expectedOutput );
273313 }
314+
274315}
0 commit comments