This commit is contained in:
jamesagnew 2021-01-28 16:22:36 -05:00
parent 0be3f0e4e8
commit 8854f344b3
1 changed files with 16 additions and 1 deletions

View File

@ -21,6 +21,7 @@ public class FhirResourceDaoR4ReferentialIntegrityTest extends BaseJpaR4Test {
public void afterResetConfig() {
myDaoConfig.setEnforceReferentialIntegrityOnWrite(new DaoConfig().isEnforceReferentialIntegrityOnWrite());
myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete());
myDaoConfig.setEnforceReferenceTargetTypes(new DaoConfig().isEnforceReferenceTargetTypes());
}
@Test
@ -38,7 +39,7 @@ public class FhirResourceDaoR4ReferentialIntegrityTest extends BaseJpaR4Test {
}
@Test
public void testCreateUnknownReferenceAllow() throws Exception {
public void testCreateUnknownReferenceAllowed() {
myDaoConfig.setEnforceReferentialIntegrityOnWrite(false);
Patient p = new Patient();
@ -50,6 +51,20 @@ public class FhirResourceDaoR4ReferentialIntegrityTest extends BaseJpaR4Test {
}
@Test
public void testCreateUnknownReferenceAllowed_NumericId() {
myDaoConfig.setEnforceReferentialIntegrityOnWrite(false);
myDaoConfig.setEnforceReferenceTargetTypes(false);
Patient p = new Patient();
p.setManagingOrganization(new Reference("Organization/123"));
IIdType id = myPatientDao.create(p).getId().toUnqualifiedVersionless();
p = myPatientDao.read(id);
assertEquals("Organization/123", p.getManagingOrganization().getReference());
}
@Test
public void testDeleteFail() throws Exception {
Organization o = new Organization();