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:
Pinaki Poddar 2010-02-18 01:26:04 +00:00
parent 3cd8c4c6f0
commit bdb1e5d6f2
1 changed files with 3 additions and 6 deletions

View File

@ -76,21 +76,18 @@ public class TestUnwrap extends SingleEMFTestCase {
public void testInvalidEntityManagerUnwrap() {
EntityManager em = emf.createEntityManager();
Class<?>[] validCasts = new Class[] {
Class<?>[] invalidCasts = new Class[] {
Object.class,
Properties.class,
null,
};
for (Class<?> c : validCasts) {
for (Class<?> c : invalidCasts) {
try {
em.unwrap(c);
fail("Expected to fail to unwarp with " + c);
} catch (PersistenceException e) {
} catch (Exception e) {
EntityTransaction txn = em.getTransaction();
assertFalse(txn.isActive());
} catch (Exception ex) {
ex.printStackTrace();
fail("Unexpected exception while unwrapping " + c);
}
}
}