This commit is contained in:
dotasek 2022-11-29 12:44:07 -05:00
parent 8d485c0f34
commit 2daeaec173
2 changed files with 17 additions and 17 deletions

View File

@ -14,8 +14,8 @@ import java.util.stream.Stream;
public class Immunization30_40Test {
private org.hl7.fhir.r4.formats.JsonParser r4_parser = new org.hl7.fhir.r4.formats.JsonParser();
private org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
private org.hl7.fhir.r4.formats.JsonParser r4Parser = new org.hl7.fhir.r4.formats.JsonParser();
private org.hl7.fhir.dstu3.formats.JsonParser dstu3Parser = new org.hl7.fhir.dstu3.formats.JsonParser();
public static Stream<Arguments> getR4toDSTU3Arguments() {
return Stream.of(
@ -24,39 +24,39 @@ public class Immunization30_40Test {
}
@ParameterizedTest(name = "Test r4 -> dstu3 immunization conversions {0}")
@MethodSource("getR4toDSTU3Arguments")
public void test1(String testName, String r4_input_resource, String dstu3_expected_output_resource) throws IOException {
InputStream r4_input = this.getClass().getResourceAsStream(r4_input_resource);
InputStream dstu3_expected_output = this.getClass().getResourceAsStream(dstu3_expected_output_resource);
public void test1(String testName, String r4InputResource, String dstu3ExpectedOutputResource) throws IOException {
InputStream r4_input = this.getClass().getResourceAsStream(r4InputResource);
InputStream dstu3ExpectedOutput = this.getClass().getResourceAsStream(dstu3ExpectedOutputResource);
org.hl7.fhir.r4.model.Immunization r4_actual = (org.hl7.fhir.r4.model.Immunization) r4_parser.parse(r4_input);
org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertorFactory_30_40.convertResource(r4_actual, new BaseAdvisor_30_40(false));
org.hl7.fhir.r4.model.Immunization r4Actual = (org.hl7.fhir.r4.model.Immunization) r4Parser.parse(r4_input);
org.hl7.fhir.dstu3.model.Resource dstu3Converted = VersionConvertorFactory_30_40.convertResource(r4Actual, new BaseAdvisor_30_40(false));
org.hl7.fhir.dstu3.model.Resource dstu3_expected = dstu3_parser.parse(dstu3_expected_output);
org.hl7.fhir.dstu3.model.Resource dstu3Expected = dstu3Parser.parse(dstu3ExpectedOutput);
Assertions.assertTrue(dstu3_expected.equalsDeep(dstu3_conv),
"Failed comparing\n" + dstu3_parser.composeString(dstu3_expected) + "\nand\n" + dstu3_parser.composeString(dstu3_conv));
Assertions.assertTrue(dstu3Expected.equalsDeep(dstu3Converted),
"Failed comparing\n" + dstu3Parser.composeString(dstu3Expected) + "\nand\n" + dstu3Parser.composeString(dstu3Converted));
}
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.json", "/immunization_40_completed_given.json")
Arguments.of("test2", "/immunization_30_completed_given.json", "/immunization_40_completed_given.json")
);
}
@ParameterizedTest(name = "Test dstu3 -> r4 immunization conversions {0}")
@MethodSource("getDSTU3toR4Arguments")
public void test2(String testName, String dstu3_input_resource, String r4_expected_output_resource) throws IOException {
InputStream dstu3_input = this.getClass().getResourceAsStream(dstu3_input_resource);
public void test2(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) dstu3_parser.parse(dstu3_input);
org.hl7.fhir.dstu3.model.Immunization dstu3_actual = (org.hl7.fhir.dstu3.model.Immunization) dstu3Parser.parse(dstu3_input);
org.hl7.fhir.r4.model.Resource r4_conv = VersionConvertorFactory_30_40.convertResource(dstu3_actual, new BaseAdvisor_30_40(false));
InputStream r4_expected_output = this.getClass().getResourceAsStream(r4_expected_output_resource);
org.hl7.fhir.r4.model.Resource r4_expected = r4_parser.parse(r4_expected_output);
InputStream r4_expected_output = this.getClass().getResourceAsStream(r4ExpectedOutputResource);
org.hl7.fhir.r4.model.Resource r4_expected = r4Parser.parse(r4_expected_output);
Assertions.assertTrue(r4_expected.equalsDeep(r4_conv),
"Failed comparing\n" + r4_parser.composeString(r4_expected) + "\nand\n" + r4_parser.composeString(r4_conv));
"Failed comparing\n" + r4Parser.composeString(r4_expected) + "\nand\n" + r4Parser.composeString(r4_conv));
}
}