fix test setup

This commit is contained in:
Grahame Grieve 2022-12-26 20:47:33 +13:00
parent 44b25be2a5
commit ead7eadfc0
3 changed files with 92 additions and 4 deletions

View File

@ -22,8 +22,8 @@ public class StructureDefinition40_50Test {
@Test
@DisplayName("Test r5 -> r4 AuditEvent conversion.")
public void testR5_R4() throws IOException {
byte[] r4_input = TestingUtilities.loadTestResourceBytes("conversion", "sd-xpath-constraint-r4.xml");
byte[] r5_input = TestingUtilities.loadTestResourceBytes("conversion", "sd-xpath-constraint-r5.xml");
byte[] r4_input = TextFile.streamToBytes(this.getClass().getResourceAsStream("/sd-xpath-constraint-r4.xml"));
byte[] r5_input = TextFile.streamToBytes(this.getClass().getResourceAsStream("/sd-xpath-constraint-r5.xml"));
org.hl7.fhir.r5.model.StructureDefinition r5_actual = (org.hl7.fhir.r5.model.StructureDefinition) new org.hl7.fhir.r5.formats.XmlParser().parse(r5_input);
org.hl7.fhir.r4.model.StructureDefinition r4_conv = (org.hl7.fhir.r4.model.StructureDefinition) VersionConvertorFactory_40_50.convertResource(r5_actual);
@ -40,8 +40,8 @@ public class StructureDefinition40_50Test {
@Test
@DisplayName("Test r4 -> r5 AuditEvent conversion.")
public void testR4_R5() throws IOException {
byte[] r4_input = TestingUtilities.loadTestResourceBytes("conversion", "sd-xpath-constraint-r4.xml");
byte[] r5_input = TestingUtilities.loadTestResourceBytes("conversion", "sd-xpath-constraint-r5.xml");
byte[] r4_input = TextFile.streamToBytes(this.getClass().getResourceAsStream("/sd-xpath-constraint-r4.xml"));
byte[] r5_input = TextFile.streamToBytes(this.getClass().getResourceAsStream("/sd-xpath-constraint-r5.xml"));
org.hl7.fhir.r4.model.StructureDefinition r4_actual = (org.hl7.fhir.r4.model.StructureDefinition) new org.hl7.fhir.r4.formats.XmlParser().parse(r4_input);
org.hl7.fhir.r5.model.StructureDefinition r5_conv = (org.hl7.fhir.r5.model.StructureDefinition) VersionConvertorFactory_40_50.convertResource(r4_actual);

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="us-core-patient"/>
<url value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"/>
<version value="6.0.0-preview"/>
<name value="USCorePatientProfile"/>
<title value="US Core Patient Profile"/>
<status value="active"/>
<experimental value="false"/>
<date value="2022-09-30"/>
<publisher value="HL7 International - Cross-Group Projects"/>
<fhirVersion value="4.0.1"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Patient"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient"/>
<derivation value="constraint"/>
<differential>
<element id="Patient">
<path value="Patient"/>
<definition value="\-"/>
<comment value="\-"/>
<mustSupport value="false"/>
</element>
<element id="Patient.name">
<path value="Patient.name"/>
<min value="1"/>
<constraint>
<key value="us-core-6"/>
<severity value="error"/>
<human value="At least name.given and/or name.family are present or, if neither is available, the Data Absent Reason Extension is present."/>
<expression value="(family.exists() or given.exists()) xor extension.where(url='http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists()"/>
<xpath value="(/f:extension/@url='http://hl7.org/fhir/StructureDefinition/data-absent-reason' and not(/f:family or /f:given)) or (not(/f:extension/@url='http://hl7.org/fhir/StructureDefinition/data-absent-reason') and (/f:family or /f:given))"/>
</constraint>
<mustSupport value="true"/>
<mapping>
<identity value="argonaut-dq-dstu2"/>
<map value="Patient.name"/>
</mapping>
</element>
</differential>
</StructureDefinition>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="us-core-patient"/>
<url value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"/>
<version value="6.0.0-preview"/>
<name value="USCorePatientProfile"/>
<title value="US Core Patient Profile"/>
<status value="active"/>
<experimental value="false"/>
<date value="2022-09-30"/>
<publisher value="HL7 International - Cross-Group Projects"/>
<fhirVersion value="4.0.1"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Patient"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient"/>
<derivation value="constraint"/>
<differential>
<element id="Patient">
<path value="Patient"/>
<definition value="\-"/>
<comment value="\-"/>
<mustSupport value="false"/>
</element>
<element id="Patient.name">
<path value="Patient.name"/>
<min value="1"/>
<constraint>
<extension url="http://hl7.org/fhir/4.0/StructureDefinition/extension-ElementDefinition.constraint.xpath">
<valueString value="(/f:extension/@url='http://hl7.org/fhir/StructureDefinition/data-absent-reason' and not(/f:family or /f:given)) or (not(/f:extension/@url='http://hl7.org/fhir/StructureDefinition/data-absent-reason') and (/f:family or /f:given))"/>
</extension>
<key value="us-core-6"/>
<severity value="error"/>
<human value="At least name.given and/or name.family are present or, if neither is available, the Data Absent Reason Extension is present."/>
<expression value="(family.exists() or given.exists()) xor extension.where(url='http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists()"/>
</constraint>
<mustSupport value="true"/>
<mapping>
<identity value="argonaut-dq-dstu2"/>
<map value="Patient.name"/>
</mapping>
</element>
</differential>
</StructureDefinition>