Add test for #11
This commit is contained in:
parent
faa28cb825
commit
84c479927e
|
@ -729,6 +729,25 @@ public class XmlParserTest {
|
||||||
assertThat(str, StringContains.containsString("<Patient xmlns=\"http://hl7.org/fhir\">"));
|
assertThat(str, StringContains.containsString("<Patient xmlns=\"http://hl7.org/fhir\">"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDuplicateContainedResources() {
|
||||||
|
|
||||||
|
Observation resA = new Observation();
|
||||||
|
resA.getName().setText("A");
|
||||||
|
|
||||||
|
Observation resB = new Observation();
|
||||||
|
resB.getName().setText("B");
|
||||||
|
resB.addRelated().setTarget(new ResourceReferenceDt(resA));
|
||||||
|
resB.addRelated().setTarget(new ResourceReferenceDt(resA));
|
||||||
|
|
||||||
|
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resB);
|
||||||
|
ourLog.info(encoded);
|
||||||
|
|
||||||
|
assertThat(encoded, stringContainsInOrder(Arrays.asList("<contained>", "<Observation", "</Observation>", "</contained>")));
|
||||||
|
assertThat(encoded, not(stringContainsInOrder(Arrays.asList("<contained>", "<Observation", "</Observation>", "<Obser", "</contained>"))));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNestedContainedResources() {
|
public void testNestedContainedResources() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue