Expand tests, fix breaks
This commit is contained in:
parent
2daeaec173
commit
69db452501
|
@ -10,7 +10,7 @@ import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Bool
|
|||
import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Date30_40;
|
||||
import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.DateTime30_40;
|
||||
import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40;
|
||||
import org.hl7.fhir.dstu3.model.BooleanType;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.Extension;
|
||||
import org.hl7.fhir.r4.model.Immunization;
|
||||
|
@ -89,12 +89,14 @@ public class Immunization30_40 {
|
|||
if (src.hasStatus()) {
|
||||
tgt.setStatusElement(convertImmunizationStatus(src.getStatusElement()));
|
||||
if (src.getStatusElement().getValue() == Immunization.ImmunizationStatus.NOTDONE)
|
||||
tgt.setNotGivenElement(new BooleanType(true));
|
||||
tgt.setNotGivenElement(new org.hl7.fhir.dstu3.model.BooleanType(true));
|
||||
else
|
||||
tgt.setNotGivenElement(new org.hl7.fhir.dstu3.model.BooleanType(false));
|
||||
}
|
||||
if (src.hasExtension(NOT_GIVEN_EXTENSION_URL)) {
|
||||
Extension notGivenExtension = src.getExtensionByUrl(NOT_GIVEN_EXTENSION_URL);
|
||||
if (notGivenExtension.hasValue() && notGivenExtension.getValueAsPrimitive() instanceof org.hl7.fhir.r4.model.BooleanType)
|
||||
tgt.setNotGivenElement(new org.hl7.fhir.dstu3.model.BooleanType());
|
||||
tgt.setNotGivenElement(new org.hl7.fhir.dstu3.model.BooleanType(((org.hl7.fhir.r4.model.BooleanType)notGivenExtension.getValueAsPrimitive()).getValue()));
|
||||
}
|
||||
if (src.hasVaccineCode())
|
||||
tgt.setVaccineCode(CodeableConcept30_40.convertCodeableConcept(src.getVaccineCode()));
|
||||
|
|
|
@ -19,12 +19,15 @@ public class Immunization30_40Test {
|
|||
|
||||
public static Stream<Arguments> getR4toDSTU3Arguments() {
|
||||
return Stream.of(
|
||||
Arguments.of("test1", "/immunization_40_not-done.json", "/immunization_30_completed_notGiven.json")
|
||||
Arguments.of("not-done no notGiven extension", "/immunization_40_not-done.json", "/immunization_30_completed_notGiven.json"),
|
||||
Arguments.of("completed no notGiven extension", "/immunization_40_completed.json", "/immunization_30_completed_given.json"),
|
||||
Arguments.of("entered-in-error no notGiven extension", "/immunization_40_entered-in-error.json", "/immunization_30_entered-in-error_given.json"),
|
||||
Arguments.of("entered-in-error notGiven extension", "/immunization_40_entered-in-error_notGiven-extension.json", "/immunization_30_entered-in-error_notGiven-extension.json")
|
||||
);
|
||||
}
|
||||
@ParameterizedTest(name = "Test r4 -> dstu3 immunization conversions {0}")
|
||||
@ParameterizedTest(name = "Test r4 -> dstu3 immunization conversions: {0}")
|
||||
@MethodSource("getR4toDSTU3Arguments")
|
||||
public void test1(String testName, String r4InputResource, String dstu3ExpectedOutputResource) throws IOException {
|
||||
public void R4toDSTU3Tests(String testName, String r4InputResource, String dstu3ExpectedOutputResource) throws IOException {
|
||||
InputStream r4_input = this.getClass().getResourceAsStream(r4InputResource);
|
||||
InputStream dstu3ExpectedOutput = this.getClass().getResourceAsStream(dstu3ExpectedOutputResource);
|
||||
|
||||
|
@ -39,14 +42,15 @@ public class Immunization30_40Test {
|
|||
|
||||
public static Stream<Arguments> getDSTU3toR4Arguments() {
|
||||
return Stream.of(
|
||||
Arguments.of("test1", "/immunization_30_completed_notGiven.json", "/immunization_40_not-done_notGiven.json"),
|
||||
Arguments.of("test2", "/immunization_30_completed_given.json", "/immunization_40_completed_given.json")
|
||||
Arguments.of("completed notGiven=true", "/immunization_30_completed_notGiven.json", "/immunization_40_not-done_notGiven-extension.json"),
|
||||
Arguments.of("completed notGiven=false", "/immunization_30_completed_given.json", "/immunization_40_completed_given-extension.json"),
|
||||
Arguments.of("entered-in-error notGiven=true", "/immunization_30_entered-in-error_notGiven.json", "/immunization_40_not-done_notGiven-extension.json")
|
||||
);
|
||||
}
|
||||
|
||||
@ParameterizedTest(name = "Test dstu3 -> r4 immunization conversions {0}")
|
||||
@ParameterizedTest(name = "Test dstu3 -> r4 immunization conversions: {0}")
|
||||
@MethodSource("getDSTU3toR4Arguments")
|
||||
public void test2(String testName, String dstu3InputResource, String r4ExpectedOutputResource) throws IOException {
|
||||
public void DSTU3toR4Tests(String testName, String dstu3InputResource, String r4ExpectedOutputResource) throws IOException {
|
||||
InputStream dstu3_input = this.getClass().getResourceAsStream(dstu3InputResource);
|
||||
|
||||
org.hl7.fhir.dstu3.model.Immunization dstu3_actual = (org.hl7.fhir.dstu3.model.Immunization) dstu3Parser.parse(dstu3_input);
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"resourceType": "Immunization",
|
||||
"id": "notGiven",
|
||||
"text": {
|
||||
"status": "generated",
|
||||
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">dummyDiv</div>"
|
||||
},
|
||||
"status": "entered-in-error",
|
||||
"notGiven": false,
|
||||
"vaccineCode": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/sid/cvx",
|
||||
"code": "01",
|
||||
"display": "DTP"
|
||||
}
|
||||
]
|
||||
},
|
||||
"patient": {
|
||||
"reference": "Patient/example"
|
||||
},
|
||||
"date": "2013-01-10",
|
||||
"primarySource": true
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"resourceType": "Immunization",
|
||||
"id": "notGiven",
|
||||
"text": {
|
||||
"status": "generated",
|
||||
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">dummyDiv</div>"
|
||||
},
|
||||
"status": "entered-in-error",
|
||||
"notGiven": true,
|
||||
"extension":[
|
||||
{
|
||||
"url":"http://hl7.org/fhir/3.0/StructureDefinition/extension-Immunization.notGiven",
|
||||
"valueBoolean":true
|
||||
}
|
||||
],
|
||||
"vaccineCode": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/sid/cvx",
|
||||
"code": "01",
|
||||
"display": "DTP"
|
||||
}
|
||||
]
|
||||
},
|
||||
"patient": {
|
||||
"reference": "Patient/example"
|
||||
},
|
||||
"date": "2013-01-10",
|
||||
"primarySource": true
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"resourceType": "Immunization",
|
||||
"id": "notGiven",
|
||||
"text": {
|
||||
"status": "generated",
|
||||
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">dummyDiv</div>"
|
||||
},
|
||||
"status": "entered-in-error",
|
||||
"notGiven": true,
|
||||
"vaccineCode": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/sid/cvx",
|
||||
"code": "01",
|
||||
"display": "DTP"
|
||||
}
|
||||
]
|
||||
},
|
||||
"patient": {
|
||||
"reference": "Patient/example"
|
||||
},
|
||||
"date": "2013-01-10",
|
||||
"primarySource": true
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"resourceType": "Immunization",
|
||||
"id": "notGiven",
|
||||
"text": {
|
||||
"status": "generated",
|
||||
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">dummyDiv</div>"
|
||||
},
|
||||
"status": "completed",
|
||||
"vaccineCode": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/sid/cvx",
|
||||
"code": "01",
|
||||
"display": "DTP"
|
||||
}
|
||||
]
|
||||
},
|
||||
"patient": {
|
||||
"reference": "Patient/example"
|
||||
},
|
||||
"occurrenceDateTime": "2013-01-10",
|
||||
"primarySource": true
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"resourceType": "Immunization",
|
||||
"id": "notGiven",
|
||||
"text": {
|
||||
"status": "generated",
|
||||
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">dummyDiv</div>"
|
||||
},
|
||||
"status": "entered-in-error",
|
||||
"vaccineCode": {
|
||||
"coding": [
|
||||
{
|
||||
"system": "http://hl7.org/fhir/sid/cvx",
|
||||
"code": "01",
|
||||
"display": "DTP"
|
||||
}
|
||||
]
|
||||
},
|
||||
"patient": {
|
||||
"reference": "Patient/example"
|
||||
},
|
||||
"occurrenceDateTime": "2013-01-10",
|
||||
"primarySource": true
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
"valueBoolean":true
|
||||
}
|
||||
],
|
||||
"status": "completed",
|
||||
"status": "entered-in-error",
|
||||
"vaccineCode": {
|
||||
"coding": [
|
||||
{
|
Loading…
Reference in New Issue