adding test for observation conversion 10_40

This commit is contained in:
Itay Goren 2021-02-03 10:34:27 +02:00
parent f56235d596
commit 9d84343fee
4 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1 @@
add test for Observation conversion from 10 to 40

View File

@ -0,0 +1,31 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.InputStream;
public class Observation10_40Test {
@Test
@DisplayName("Test 10_40 Observation conversion")
public void testObservationConversion() throws IOException {
InputStream dstu2_input = this.getClass().getResourceAsStream("/0_observation_10.json");
InputStream r4_exepected_input = this.getClass().getResourceAsStream("/0_observation_40.json");
org.hl7.fhir.dstu2.model.Observation dstu2 = (org.hl7.fhir.dstu2.model.Observation) new org.hl7.fhir.dstu2.formats.JsonParser().parse(dstu2_input);
VersionConvertorAdvisor40 advisor = new IGR2ConvertorAdvisor();
org.hl7.fhir.r4.model.Resource r4_actual = VersionConvertor_10_40.convertResource(dstu2, advisor);
org.hl7.fhir.r4.formats.JsonParser r4_parser = new org.hl7.fhir.r4.formats.JsonParser();
org.hl7.fhir.r4.model.Resource r4_expected = r4_parser.parse(r4_exepected_input);
Assertions.assertTrue(r4_expected.equalsDeep(r4_actual),
"Failed comparing\n" + r4_parser.composeString(r4_actual) + "\nand\n" + r4_parser.composeString(r4_expected));
}
}

View File

@ -0,0 +1,42 @@
{
"resourceType": "Observation",
"id": "fobafoba",
"status": "final",
"category": {
"coding": [
{
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
}
],
"text": "Laboratory"
},
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "2885-2",
"display": "Protein [Mass/volume] in Serum or Plasma"
}
],
"text": "PROTEIN,TOTAL"
},
"subject": {
"display": "Mr shoko",
"reference": "other subject"
},
"effectiveDateTime": "2016-04-12T05:57:00Z",
"issued": "2016-04-12T05:57:00Z",
"valueQuantity": {
"value": 5.5,
"unit": "g/dL",
"system": "http://unitsofmeasure.org",
"code": "g/dL"
},
"referenceRange": [
{
"text": "6.0 - 8.2"
}
]
}

View File

@ -0,0 +1,44 @@
{
"resourceType": "Observation",
"id": "fobafoba",
"status": "final",
"category": [
{
"coding": [
{
"system": "http://hl7.org/fhir/observation-category",
"code": "laboratory",
"display": "Laboratory"
}
],
"text": "Laboratory"
}
],
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "2885-2",
"display": "Protein [Mass/volume] in Serum or Plasma"
}
],
"text": "PROTEIN,TOTAL"
},
"subject": {
"display": "Mr shoko",
"reference": "other subject"
},
"effectiveDateTime": "2016-04-12T05:57:00Z",
"issued": "2016-04-12T05:57:00Z",
"valueQuantity": {
"value": 5.5,
"unit": "g/dL",
"system": "http://unitsofmeasure.org",
"code": "g/dL"
},
"referenceRange": [
{
"text": "6.0 - 8.2"
}
]
}