public void testSetToNewFromMappedBySide() {
testMethod = "testSetToNewFromMappedBySide";
if (isTestToBePerformed) {
// Set relationship
IMedicalInsurance medInsNew = new MedicalInsurance(99L,
"Ameriblast", "B");
pm.makePersistent(medInsNew);
emp1.setMedicalInsurance(medInsNew);
Object medInsNewOid = pm.getObjectId((Object)medInsNew);
pm.flush();
assertFalse(testMethod + ": Test aborted, precondition is false; " +
"expected medInsNewOid to be non-null", medInsNewOid == null);
// Postcondition
deferredAssertTrue(medInsNew.getEmployee() == emp1,
ASSERTION_FAILED + testMethod,
"Postcondition is false; "
+ "other side of relationship not set on flush.");
deferredAssertTrue(medIns1.getEmployee() == null,
ASSERTION_FAILED + testMethod,
"Postcondition is false; "
+ "previous relationship (medIns1) not nulled on flush.");
pm.currentTransaction().commit();
cleanupPM();
getPM();
pm.currentTransaction().begin();
emp1 = (IEmployee)pm.getObjectById(emp1Oid);
medInsNew = (IMedicalInsurance)pm.getObjectById(medInsNewOid);
medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
deferredAssertTrue(medInsNew.getEmployee() == emp1,
ASSERTION_FAILED + testMethod,
"Postcondition is false; "
+ "other side of relationship not set in new pm");
deferredAssertTrue(medIns1.getEmployee() == null,
ASSERTION_FAILED + testMethod,