* close or cleared is called when tx commits
*/
public void testCloseOnCommit() throws Exception {
tm.begin();
CMPEntityManagerTxScoped entityManager1 = new CMPEntityManagerTxScoped(tm, persistenceUnit, entityManagerFactory, null);
MockEntityManager pc1 = (MockEntityManager) entityManager1.find(EntityManager.class, "this");
assertTrue("entityManager should not be closed or cleared", !pc1.isClosed() & !pc1.isCleared());
tm.commit();
assertTrue("entityManager should be closed or cleared", pc1.isClosed() || pc1.isCleared());
tm.begin();
CMPEntityManagerTxScoped entityManager2 = new CMPEntityManagerTxScoped(tm, persistenceUnit, entityManagerFactory, null);
MockEntityManager pc2 = (MockEntityManager) entityManager2.find(EntityManager.class, "this");
assertTrue("entityManager should not be closed or cleared", !pc2.isClosed() & !pc2.isCleared());
tm.rollback();
assertTrue("entityManager should be closed or cleared", pc2.isClosed() || pc2.isCleared());
}