Also fixes #724 - Added unit tests to ensure that the IDs of instances of DomainResource subclasses get copied as expected
This commit is contained in:
parent
d575fb8ee7
commit
7b46bca1bf
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue