Search in sources :

Example 1 with ExpressionAdvisor50

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

the class Expression50Test method testAdvisorExpressionConversion50_10.

@Test
@DisplayName("Test Advisor is used in Expression R5 -> DSTU3 conversion.")
public void testAdvisorExpressionConversion50_10() throws IOException {
    InputStream r5_stream = this.getClass().getResourceAsStream("/questionnaire_with_expression_50.json");
    org.hl7.fhir.r5.model.Questionnaire r5_input = (org.hl7.fhir.r5.model.Questionnaire) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_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_50.convertResource(r5_input, new ExpressionAdvisor50());
    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 : ExpressionAdvisor50(org.hl7.fhir.convertors.advisors.support.ExpressionAdvisor50) InputStream(java.io.InputStream) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Aggregations

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