From bdb1e5d6f2984ec3b7e5e6c84c9595bba25e693b Mon Sep 17 00:00:00 2001 From: Pinaki Poddar Date: Thu, 18 Feb 2010 01:26:04 +0000 Subject: [PATCH] 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 --- .../java/org/apache/openjpa/persistence/TestUnwrap.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestUnwrap.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestUnwrap.java index c5f5fd1ef..2ec29377c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestUnwrap.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/TestUnwrap.java @@ -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); } } }