Search in sources :

Example 6 with VersionConvertorFactory_10_30

use of org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30 in project org.hl7.fhir.core by hapifhir.

the class AllergyIntolerance10_30Test method testMedicationRequestConversion.

@ParameterizedTest
@MethodSource("filesPaths")
@DisplayName("Test 10_30 AllergyIntolerance conversion")
public void testMedicationRequestConversion(String dstu2_path, String stu_path) throws IOException {
    InputStream dstu2_input = this.getClass().getResourceAsStream(dstu2_path);
    InputStream stu_exepected_input = this.getClass().getResourceAsStream(stu_path);
    org.hl7.fhir.dstu2.model.AllergyIntolerance dstu2 = (org.hl7.fhir.dstu2.model.AllergyIntolerance) new org.hl7.fhir.dstu2.formats.JsonParser().parse(dstu2_input);
    org.hl7.fhir.dstu3.model.Resource stu_actual = VersionConvertorFactory_10_30.convertResource(dstu2, new BaseAdvisor_10_30());
    org.hl7.fhir.dstu3.formats.JsonParser stu_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
    org.hl7.fhir.dstu3.model.Resource stu_expected = stu_parser.parse(stu_exepected_input);
    if (!stu_expected.equalsDeep(stu_actual)) {
        System.out.println("Expected");
        System.out.println(stu_parser.composeString(stu_expected));
        System.out.println();
        System.out.println("Actual");
        System.out.println(stu_parser.composeString(stu_actual));
    }
    Assertions.assertTrue(stu_expected.equalsDeep(stu_actual), "Failed comparing\n" + stu_parser.composeString(stu_actual) + "\nand\n" + stu_parser.composeString(stu_expected));
}
Also used : InputStream(java.io.InputStream) BaseAdvisor_10_30(org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_30) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

InputStream (java.io.InputStream)3 BaseAdvisor_10_30 (org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_30)3 DisplayName (org.junit.jupiter.api.DisplayName)3 FHIRException (org.hl7.fhir.exceptions.FHIRException)2 Test (org.junit.jupiter.api.Test)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 MethodSource (org.junit.jupiter.params.provider.MethodSource)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 UUID (java.util.UUID)1 VersionConvertorFactory_10_30 (org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30)1 JsonParser (org.hl7.fhir.dstu2.formats.JsonParser)1 XmlParser (org.hl7.fhir.dstu2.formats.XmlParser)1 Resource (org.hl7.fhir.dstu2.model.Resource)1 StringType (org.hl7.fhir.dstu2.model.StringType)1 Resource (org.hl7.fhir.dstu2016may.model.Resource)1 Bundle (org.hl7.fhir.dstu3.model.Bundle)1 BundleEntryComponent (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent)1 BundleType (org.hl7.fhir.dstu3.model.Bundle.BundleType)1