parent
1db9f726f9
commit
4de0e38e01
|
@ -425,6 +425,38 @@ public class XmlParserDstu2Test {
|
|||
ourCtx = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* See #448
|
||||
*/
|
||||
@Test
|
||||
public void testParseWithMultipleProfiles() {
|
||||
ourCtx = FhirContext.forDstu2();
|
||||
ourCtx.setDefaultTypeForProfile(CustomObservationDstu2.PROFILE, CustomObservationDstu2.class);
|
||||
ourCtx.setDefaultTypeForProfile(CustomDiagnosticReportDstu2.PROFILE, CustomDiagnosticReportDstu2.class);
|
||||
|
||||
//@formatter:off
|
||||
String input =
|
||||
"<DiagnosticReport xmlns=\"http://hl7.org/fhir\">" +
|
||||
"<meta>" +
|
||||
"<profile value=\"" + CustomDiagnosticReportDstu2.PROFILE + "\"/>" +
|
||||
"<profile value=\"http://custom_DiagnosticReport2\"/>" +
|
||||
"<profile value=\"http://custom_DiagnosticReport3\"/>" +
|
||||
"</meta>" +
|
||||
"<status value=\"final\"/>" +
|
||||
"</DiagnosticReport>";
|
||||
//@formatter:on
|
||||
|
||||
IParser parser = ourCtx.newXmlParser();
|
||||
CustomDiagnosticReportDstu2 dr = (CustomDiagnosticReportDstu2) parser.parseResource(input);
|
||||
assertEquals(DiagnosticReportStatusEnum.FINAL, dr.getStatusElement().getValueAsEnum());
|
||||
|
||||
List<IdDt> profiles = ResourceMetadataKeyEnum.PROFILES.get(dr);
|
||||
assertEquals(3, profiles.size());
|
||||
|
||||
ourCtx = null;
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeAndParseContainedNonCustomTypes() {
|
||||
ourCtx = FhirContext.forDstu2();
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -241,6 +241,10 @@
|
|||
<name>Matt Clarke</name>
|
||||
<organization>Orion Health</organization>
|
||||
</developer>
|
||||
<developer>
|
||||
<id>FilipDomazet</id>
|
||||
<name>Filip Domazet</name>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<licenses>
|
||||
|
|
|
@ -36,6 +36,12 @@
|
|||
Times before 1970 with fractional milliseconds were parsed incorrectly. Thanks
|
||||
to GitHub user @CarthageKing for reporting!
|
||||
</action>
|
||||
<action type="fix" issue="448">
|
||||
Prevent crash in parser when parsing resource
|
||||
with multiple profile declarations when
|
||||
default type for profile is used. Thanks to
|
||||
Filip Domazet for the pull request!
|
||||
</action>
|
||||
</release>
|
||||
<release version="2.0" date="2016-08-30">
|
||||
<action type="fix">
|
||||
|
|
Loading…
Reference in New Issue