diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/DomainResourceDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/DomainResourceDstu2_1Test.java new file mode 100644 index 00000000000..f5949a8ec1b --- /dev/null +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/DomainResourceDstu2_1Test.java @@ -0,0 +1,21 @@ +package ca.uhn.fhir.model; + +import static org.junit.Assert.assertEquals; +import org.hl7.fhir.dstu2016may.model.Patient; +import org.junit.Test; + +public class DomainResourceDstu2_1Test { + /** + * Ensuring that IDs of subtypes of DomainResource get copied when + * the {@link org.hl7.fhir.dstu2016may.model.DomainResource#copy() method is called + */ + @Test + public void testPatientIdCopy() { + Patient p1 = new Patient(); + p1.setId("1001"); + + Patient copiedPatient = p1.copy(); + String copiedPatientID = copiedPatient.getIdElement().getIdPart(); + assertEquals("1001", copiedPatientID); + } +} diff --git a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/DomainResourceDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/DomainResourceDstu3Test.java new file mode 100644 index 00000000000..8a5ee103697 --- /dev/null +++ b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/model/DomainResourceDstu3Test.java @@ -0,0 +1,20 @@ +package org.hl7.fhir.dstu3.model; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class DomainResourceDstu3Test { + /** + * Ensuring that IDs of subtypes of DomainResource get copied when + * the {@link DomainResource#copy() method is called + */ + @Test + public void testPatientIdCopy() { + Patient p1 = new Patient(); + p1.setId("1001"); + + Patient copiedPatient = p1.copy(); + String copiedPatientID = copiedPatient.getIdElement().getIdPart(); + assertEquals("1001", copiedPatientID); + } +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/DomainResourceHL7_Dstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/DomainResourceHL7_Dstu2Test.java new file mode 100644 index 00000000000..b1441af11fc --- /dev/null +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/model/DomainResourceHL7_Dstu2Test.java @@ -0,0 +1,21 @@ +package ca.uhn.fhir.model; + +import static org.junit.Assert.assertEquals; +import org.hl7.fhir.instance.model.Patient; +import org.junit.Test; + +public class DomainResourceHL7_Dstu2Test { + /** + * Ensuring that IDs of subtypes of DomainResource get copied when + * the {@link org.hl7.fhir.instance.model.DomainResource#copy() method is called + */ + @Test + public void testPatientIdCopy() { + Patient p1 = new Patient(); + p1.setId("1001"); + + Patient copiedPatient = p1.copy(); + String copiedPatientID = copiedPatient.getIdElement().getIdPart(); + assertEquals("1001", copiedPatientID); + } +} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/DomainResourceR4Test.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/DomainResourceR4Test.java new file mode 100644 index 00000000000..5506516deaf --- /dev/null +++ b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/DomainResourceR4Test.java @@ -0,0 +1,20 @@ +package org.hl7.fhir.r4.model; + +import static org.junit.Assert.assertEquals; +import org.junit.Test; + +public class DomainResourceR4Test { + /** + * Ensuring that IDs of subtypes of DomainResource get copied when + * the {@link DomainResource#copy() method is called + */ + @Test + public void testPatientIdCopy() { + Patient p1 = new Patient(); + p1.setId("1001"); + + Patient copiedPatient = p1.copy(); + String copiedPatientID = copiedPatient.getIdElement().getIdPart(); + assertEquals("1001", copiedPatientID); + } +}