public void testSetToNewFromMappedSide() {
testMethod = "testSetToNewFromMappedSide";
if (isTestToBePerformed) {
// Set relationship
IEmployee empNew = new FullTimeEmployee(99, "Matthew", "", "Adams",
new Date(0L), new Date(10000L), 125000);
pm.makePersistent(empNew);
medIns1.setEmployee(empNew);
Object empNewOid = pm.getObjectId((Object)empNew);
pm.flush();
assertFalse(testMethod + ": Test aborted, precondition is false; " +
"expected empNewOid to be non-null", empNewOid == null);
// Postcondition
deferredAssertTrue(empNew.getMedicalInsurance() == medIns1,
ASSERTION_FAILED + testMethod,
"Postcondition is false; "
+ "other side of relationship not set on flush");
deferredAssertTrue(emp1.getMedicalInsurance() == null,
ASSERTION_FAILED + testMethod,
"Postcondition is false; "
+ "previous relationship (emp1) not nulled on flush");
pm.currentTransaction().commit();
cleanupPM();
getPM();
pm.currentTransaction().begin();
emp1 = (IEmployee)pm.getObjectById(emp1Oid);
empNew = (IEmployee)pm.getObjectById(empNewOid);
medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
deferredAssertTrue(empNew.getMedicalInsurance() == medIns1,
ASSERTION_FAILED + testMethod,
"Postcondition is false; "
+ "other side of relationship not set in new pm");
deferredAssertTrue(emp1.getMedicalInsurance() == null,
ASSERTION_FAILED + testMethod,