Add a test

This commit is contained in:
James Agnew 2018-10-18 15:12:22 -04:00
parent d6e47002c0
commit c8db7fe035
2 changed files with 20 additions and 1 deletions

View File

@ -1765,7 +1765,6 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao,
ourLog.debug("Starting entity update");
i
/*
* This should be the very first thing..
*/

View File

@ -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("<comment value=\"123&#xa;456\"/>"));
o = ourCtx.newXmlParser().parseResource(Observation.class, encoded);
assertEquals("123\n456", o.getComment());
}
/**
* See #11
*/