}
}
public void testExistingTransaction() {
PlatformTransactionManager tm = new TestTransactionManager(true, true);
DefaultTransactionStatus status1 = (DefaultTransactionStatus)
tm.getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_SUPPORTS));
assertTrue("Must have transaction", status1.getTransaction() != null);
assertTrue("Must not be new transaction", !status1.isNewTransaction());
DefaultTransactionStatus status2 = (DefaultTransactionStatus)
tm.getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED));
assertTrue("Must have transaction", status2.getTransaction() != null);
assertTrue("Must not be new transaction", !status2.isNewTransaction());
try {
DefaultTransactionStatus status3 = (DefaultTransactionStatus)
tm.getTransaction(new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_MANDATORY));
assertTrue("Must have transaction", status3.getTransaction() != null);
assertTrue("Must not be new transaction", !status3.isNewTransaction());
}
catch (NoTransactionException ex) {
fail("Should not have thrown NoTransactionException");
}
}