From 4494a6f757d28a38e4a271dd808965c6c18bbe50 Mon Sep 17 00:00:00 2001 From: dotasek Date: Mon, 17 Apr 2023 17:24:19 -0400 Subject: [PATCH] Expand with actual use case test --- .../conv43_50/SubscriptionTopic43_50Test.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv43_50/SubscriptionTopic43_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv43_50/SubscriptionTopic43_50Test.java index a946544e3..7d87bb3fc 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv43_50/SubscriptionTopic43_50Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/conv43_50/SubscriptionTopic43_50Test.java @@ -15,7 +15,7 @@ public class SubscriptionTopic43_50Test { @Test @DisplayName("Test r5 -> r4 SubscriptionTopic conversion.") - public void testR5_R4() throws IOException { + public void testR5_R4b() throws IOException { InputStream r5_input = this.getClass().getResourceAsStream("/subscription_topic_50.json"); org.hl7.fhir.r5.model.SubscriptionTopic r5_actual = (org.hl7.fhir.r5.model.SubscriptionTopic) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input); @@ -32,4 +32,22 @@ public class SubscriptionTopic43_50Test { assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same"); } + @Test + @DisplayName("Test r4b -> r5 SubscriptionTopic conversion.") + public void testR4b_R5() throws IOException { + InputStream r4b_input = this.getClass().getResourceAsStream("/subscription_topic_43.json"); + + org.hl7.fhir.r4b.model.SubscriptionTopic r4b_actual = (org.hl7.fhir.r4b.model.SubscriptionTopic) new org.hl7.fhir.r4b.formats.JsonParser().parse(r4b_input); + org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_43_50.convertResource(r4b_actual); + + org.hl7.fhir.r5.formats.JsonParser r5_parser = new org.hl7.fhir.r5.formats.JsonParser(); + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + r5_parser.compose(stream, r5_conv); + + org.hl7.fhir.r5.model.Resource r5_streamed = new org.hl7.fhir.r5.formats.JsonParser().parse(new ByteArrayInputStream(stream.toByteArray())); + org.hl7.fhir.r4b.model.Resource r4b_conv = VersionConvertorFactory_43_50.convertResource(r5_streamed); + + assertTrue(r4b_actual.equalsDeep(r4b_conv), "should be the same"); + } }