Add test for #390

This commit is contained in:
jamesagnew 2016-06-24 06:10:03 -04:00
parent f4c6f09f08
commit 16df4566bf
1 changed files with 18 additions and 0 deletions

View File

@ -92,6 +92,24 @@ public class JsonParserDstu2Test {
assertThat(output, containsString("\"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">VALUE</div>\""));
}
/**
* See #390
*/
@Test
public void testEncodeAndParseBundleWithNoEntries() {
ca.uhn.fhir.model.dstu2.resource.Bundle b = new ca.uhn.fhir.model.dstu2.resource.Bundle();
b.setId("123");
String encoded = ourCtx.newJsonParser().encodeResourceToString(b);
ourLog.info(encoded);
assertThat(encoded, containsString("123"));
assertThat(encoded, not(containsString("entry")));
b = ourCtx.newJsonParser().parseResource(ca.uhn.fhir.model.dstu2.resource.Bundle.class, encoded);
assertEquals("123", b.getId().getIdPart());
assertEquals(0, b.getEntry().size());
}
@Test
public void testEncodeNarrativeShouldIncludeNamespaceWithProcessingInstruction() {