From c8db7fe03585de4634a47492ffc5da36c814d472 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Thu, 18 Oct 2018 15:12:22 -0400 Subject: [PATCH] Add a test --- .../ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | 1 - .../ca/uhn/fhir/parser/XmlParserR4Test.java | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java index 911d8268109..ea1941a8885 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java @@ -1765,7 +1765,6 @@ public abstract class BaseHapiFhirDao implements IDao, ourLog.debug("Starting entity update"); -i /* * This should be the very first thing.. */ diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/XmlParserR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/XmlParserR4Test.java index a9bf13482d4..7d2eb8367c6 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/XmlParserR4Test.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/parser/XmlParserR4Test.java @@ -188,6 +188,26 @@ public class XmlParserR4Test { )); } + @Test + public void testEncodeNewLineInString() { + Observation o = new Observation(); + o.setComment("123\n456"); + String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(o); + ourLog.info(encoded); + + FhirContext + .forR4() + .newRestfulGenericClient("http://hapi.fhir.org/baseR4") + .create() + .resource(o) + .execute(); + + assertThat(encoded, containsString("")); + + o = ourCtx.newXmlParser().parseResource(Observation.class, encoded); + assertEquals("123\n456", o.getComment()); + } + /** * See #11 */