Related to issue #724 - Also ensures that the ID is copied for HL7 DSTU2 and DSTU2.1 subclasses of BackboneElement when the #copy() method is called. Also added unit tests for these and reverted the line endings of the HL7 DSTU2 and DSTU2.1 versions of the DomainResource class back to CRLF
This commit is contained in:
parent
8fb528c1c9
commit
5650238421
|
@ -159,6 +159,7 @@ public abstract class BackboneElement extends Element implements IBaseBackboneEl
|
|||
public abstract BackboneElement copy();
|
||||
|
||||
public void copyValues(BackboneElement dst) {
|
||||
super.copyValues(dst);
|
||||
if (modifierExtension != null) {
|
||||
dst.modifierExtension = new ArrayList<Extension>();
|
||||
for (Extension i : modifierExtension)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package ca.uhn.fhir.model;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.hl7.fhir.dstu2016may.model.Patient.PatientCommunicationComponent;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BackboneElementDstu2_1Test {
|
||||
/**
|
||||
* Ensuring that IDs of subtypes of BackboneElement get copied when
|
||||
* the {@link org.hl7.fhir.dstu2016may.model.BackboneElement#copy()} method is called
|
||||
*/
|
||||
@Test
|
||||
public void testPatientCommunicationComponentIdCopy() {
|
||||
PatientCommunicationComponent pcc1 = new PatientCommunicationComponent();
|
||||
pcc1.setId("1001");
|
||||
|
||||
PatientCommunicationComponent copiedPcc = pcc1.copy();
|
||||
String copiedPccID = copiedPcc.getIdElement().getIdPart();
|
||||
assertEquals("1001", copiedPccID);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.hl7.fhir.dstu3.model;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BackboneElementDstu3Test {
|
||||
/**
|
||||
* Ensuring that IDs of subtypes of BackboneElement get copied when
|
||||
* the {@link BackboneElement#copy()} method is called
|
||||
*/
|
||||
@Test
|
||||
public void testPatientCommunicationComponentIdCopy() {
|
||||
PatientCommunicationComponent pcc1 = new PatientCommunicationComponent();
|
||||
pcc1.setId("1001");
|
||||
|
||||
PatientCommunicationComponent copiedPcc = pcc1.copy();
|
||||
String copiedPccID = copiedPcc.getId();
|
||||
assertEquals("1001", copiedPccID);
|
||||
}
|
||||
}
|
|
@ -128,6 +128,7 @@ public abstract class BackboneElement extends Element implements IBaseBackboneEl
|
|||
public abstract BackboneElement copy();
|
||||
|
||||
public void copyValues(BackboneElement dst) {
|
||||
super.copyValues(dst);
|
||||
if (modifierExtension != null) {
|
||||
dst.modifierExtension = new ArrayList<Extension>();
|
||||
for (Extension i : modifierExtension)
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package ca.uhn.fhir.model;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BackboneElementHL7_Dstu2Test {
|
||||
/**
|
||||
* Ensuring that IDs of subtypes of BackboneElement get copied when
|
||||
* the {@link org.hl7.fhir.instance.model.BackboneElement#copy()} method is called
|
||||
*/
|
||||
@Test
|
||||
public void testPatientCommunicationComponentIdCopy() {
|
||||
PatientCommunicationComponent pcc1 = new PatientCommunicationComponent();
|
||||
pcc1.setId("1001");
|
||||
|
||||
PatientCommunicationComponent copiedPcc = pcc1.copy();
|
||||
String copiedPccID = copiedPcc.getIdElement().getIdPart();
|
||||
assertEquals("1001", copiedPccID);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.hl7.fhir.r4.model;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BackboneElementR4Test {
|
||||
/**
|
||||
* Ensuring that IDs of subtypes of BackboneElement get copied when
|
||||
* the {@link BackboneElement#copy()} method is called
|
||||
*/
|
||||
@Test
|
||||
public void testPatientCommunicationComponentIdCopy() {
|
||||
PatientCommunicationComponent pcc1 = new PatientCommunicationComponent();
|
||||
pcc1.setId("1001");
|
||||
|
||||
PatientCommunicationComponent copiedPcc = pcc1.copy();
|
||||
String copiedPccID = copiedPcc.getId();
|
||||
assertEquals("1001", copiedPccID);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue