}
else {
pm = getPM();
// Get transient instance and read field value
StateTransitionObj obj = getTransientInstance();
int beforeValue=obj.readField();
// Start transaction
Transaction tx = pm.currentTransaction();
tx.begin();
// Get transient dirty instance
makeTransientDirty(obj);
// Rollback
tx.rollback();
int curr = currentState(obj);
if( curr != TRANSIENT_CLEAN ){
fail(ASSERTION_FAILED,
"StateTransition: Unable to create transient-clean instance " +
"from a transient-dirty instance via tx.rollback(), state is " + states[curr]);
}
// Check that field value has been rolled back
int afterValue=obj.readField();
if (beforeValue!=afterValue)
{
fail(ASSERTION_FAILED,
"Field value incorrect after rollback. Expected: "+beforeValue+" Found: "+afterValue);
}