Search in sources :

Example 1 with ExpressionAdvisor40

use of org.hl7.fhir.convertors.advisors.support.ExpressionAdvisor40 in project org.hl7.fhir.core by hapifhir.

the class Expression40Test method testAdvisorExpressionConversion40_10.

@Test
@DisplayName("Test Advisor is used in Expression R4 -> DSTU3 conversion.")
public void testAdvisorExpressionConversion40_10() throws IOException {
    InputStream r4_stream = this.getClass().getResourceAsStream("/questionnaire_with_expression_40.json");
    org.hl7.fhir.r4.model.Questionnaire r4_input = (org.hl7.fhir.r4.model.Questionnaire) new org.hl7.fhir.r4.formats.JsonParser().parse(r4_stream);
    InputStream r2_stream = this.getClass().getResourceAsStream("/questionnaire_with_converted_expression_40_10.json");
    org.hl7.fhir.dstu2.model.Questionnaire r2_expected_output = (org.hl7.fhir.dstu2.model.Questionnaire) new org.hl7.fhir.dstu2.formats.JsonParser().parse(r2_stream);
    org.hl7.fhir.dstu2.model.Questionnaire convertedDstu2Questionnaire = (org.hl7.fhir.dstu2.model.Questionnaire) VersionConvertorFactory_10_40.convertResource(r4_input, new ExpressionAdvisor40());
    org.hl7.fhir.dstu2.formats.JsonParser dstu2_parser = new org.hl7.fhir.dstu2.formats.JsonParser();
    String composeString1 = dstu2_parser.composeString(convertedDstu2Questionnaire);
    String composeString2 = dstu2_parser.composeString(r2_expected_output);
    System.out.println("Expected out ->\n" + composeString2 + "\n\nActual out ->\n" + composeString1);
    Assertions.assertTrue(r2_expected_output.equalsDeep(convertedDstu2Questionnaire));
}
Also used : InputStream(java.io.InputStream) ExpressionAdvisor40(org.hl7.fhir.convertors.advisors.support.ExpressionAdvisor40) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

InputStream (java.io.InputStream)1 ExpressionAdvisor40 (org.hl7.fhir.convertors.advisors.support.ExpressionAdvisor40)1 DisplayName (org.junit.jupiter.api.DisplayName)1 Test (org.junit.jupiter.api.Test)1