Merge pull request #1324 from ahdis/oliveregger_#402
overwritten section text in composition #402
This commit is contained in:
commit
62ae8f85cf
|
@ -447,6 +447,34 @@ public class JsonParserR4Test {
|
|||
assertEquals("535", ((StringType) houseNumberExt.getValue()).getValue());
|
||||
|
||||
}
|
||||
|
||||
private Composition createComposition(String sectionText) {
|
||||
Composition c = new Composition();
|
||||
Narrative compositionText = new Narrative().setStatus(Narrative.NarrativeStatus.GENERATED);
|
||||
compositionText.setDivAsString("Composition");
|
||||
Narrative compositionSectionText = new Narrative().setStatus(Narrative.NarrativeStatus.GENERATED);
|
||||
compositionSectionText.setDivAsString(sectionText);
|
||||
c.setText(compositionText);
|
||||
c.addSection().setText(compositionSectionText);
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* See #402 (however JSON is fine)
|
||||
*/
|
||||
@Test
|
||||
public void testEncodingTextSection() {
|
||||
|
||||
String sectionText = "sectionText";
|
||||
Composition composition = createComposition(sectionText);
|
||||
|
||||
String encoded = ourCtx.newJsonParser().encodeResourceToString(composition);
|
||||
ourLog.info(encoded);
|
||||
|
||||
int idx = encoded.indexOf(sectionText);
|
||||
assertNotEquals(-1, idx);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 2019-09-19 - Pre #1489
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package ca.uhn.fhir.parser;
|
||||
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import org.hl7.fhir.r4.model.Composition;
|
||||
import org.hl7.fhir.r4.model.Narrative;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
||||
public class XmlParserR4Test {
|
||||
private static final Logger ourLog = LoggerFactory.getLogger(XmlParserR4Test.class);
|
||||
private static FhirContext ourCtx = FhirContext.forR4();
|
||||
|
||||
|
||||
private Composition createComposition(String sectionText) {
|
||||
Composition c = new Composition();
|
||||
Narrative compositionText = new Narrative().setStatus(Narrative.NarrativeStatus.GENERATED);
|
||||
compositionText.setDivAsString("Composition");
|
||||
Narrative compositionSectionText = new Narrative().setStatus(Narrative.NarrativeStatus.GENERATED);
|
||||
compositionSectionText.setDivAsString(sectionText);
|
||||
c.setText(compositionText);
|
||||
c.addSection().setText(compositionSectionText);
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* See #402 section.text is overwritten by composition.text
|
||||
*/
|
||||
@Test
|
||||
public void testEncodingTextSection() {
|
||||
|
||||
String sectionText = "sectionText";
|
||||
Composition composition = createComposition(sectionText);
|
||||
|
||||
String encoded = ourCtx.newXmlParser().encodeResourceToString(composition);
|
||||
ourLog.info(encoded);
|
||||
|
||||
int idx = encoded.indexOf(sectionText);
|
||||
assertNotEquals(-1, idx);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue