mirror of https://github.com/apache/openjpa.git
OPENJPA-1503: Set txn for rollback directly on illegal argument
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@911240 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3cd8c4c6f0
commit
bdb1e5d6f2
|
@ -76,21 +76,18 @@ public class TestUnwrap extends SingleEMFTestCase {
|
||||||
public void testInvalidEntityManagerUnwrap() {
|
public void testInvalidEntityManagerUnwrap() {
|
||||||
EntityManager em = emf.createEntityManager();
|
EntityManager em = emf.createEntityManager();
|
||||||
|
|
||||||
Class<?>[] validCasts = new Class[] {
|
Class<?>[] invalidCasts = new Class[] {
|
||||||
Object.class,
|
Object.class,
|
||||||
Properties.class,
|
Properties.class,
|
||||||
null,
|
null,
|
||||||
};
|
};
|
||||||
for (Class<?> c : validCasts) {
|
for (Class<?> c : invalidCasts) {
|
||||||
try {
|
try {
|
||||||
em.unwrap(c);
|
em.unwrap(c);
|
||||||
fail("Expected to fail to unwarp with " + c);
|
fail("Expected to fail to unwarp with " + c);
|
||||||
} catch (PersistenceException e) {
|
} catch (Exception e) {
|
||||||
EntityTransaction txn = em.getTransaction();
|
EntityTransaction txn = em.getTransaction();
|
||||||
assertFalse(txn.isActive());
|
assertFalse(txn.isActive());
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
fail("Unexpected exception while unwrapping " + c);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue