diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java index 8bf3b595102..01dc7ec742a 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/XmlParserDstu3Test.java @@ -115,6 +115,22 @@ public class XmlParserDstu3Test { ourCtx.setNarrativeGenerator(null); } + /** + * See #347 + */ + @Test + public void testEncodeAndParseMedicationOrder() { + MedicationOrder mo = new MedicationOrder(); + mo.getDateWrittenElement().setValueAsString("2015-10-05"); + + String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(mo); + ourLog.info(encoded); + + mo = ourCtx.newXmlParser().parseResource(MedicationOrder.class, encoded); + assertEquals("2015-10-05", mo.getDateWrittenElement().getValueAsString()); + } + + @Test public void testBundleWithBinary() { //@formatter:off