Skip to content

Commit b78be88

Browse files
* Add test for the case where an extension is provided, but the extension is not defined by the url as a description extension.
1 parent c1cefc8 commit b78be88

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

service/src/test/java/uk/nhs/adaptors/gp2gp/ehr/mapper/CodeableConceptCdMapperTest.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,36 @@ void When_WithSnomedCodingNoTextNoDisplayWithDescriptionExtensionWithDisplayExte
575575

576576
assertThat(outputMessage).isEqualToIgnoringWhitespace(expectedOutput);
577577
}
578+
579+
@Test
580+
void When_WithSnomedCodingNoTextNoDisplayWithNonDescriptionExtension_Expect_SnomedCdXmlWithoutOriginalText() {
581+
var inputJson = """
582+
{
583+
"resourceType": "Observation",
584+
"code": {
585+
"coding": [
586+
{
587+
"system": "http://snomed.info/sct",
588+
"code": "852471000000107",
589+
"extension": [
590+
{
591+
"url": "https://fhir.nhs.uk/STU3/StructureDefinition/Extension-some-otherUrl"
592+
}
593+
]
594+
}
595+
]
596+
}
597+
}""";
598+
599+
var expectedOutput = """
600+
<code nullFlavor="UNK">
601+
</code>""";
602+
var codeableConcept = fhirParseService.parseResource(inputJson, Observation.class).getCode();
603+
604+
var outputMessage = codeableConceptCdMapper.mapToNullFlavorCodeableConcept(codeableConcept);
605+
606+
assertThat(outputMessage).isEqualToIgnoringWhitespace(expectedOutput);
607+
}
578608
}
579609

580610
@ParameterizedTest

0 commit comments

Comments
 (0)