From e5a363e6519c503e0db2b1dccb37e2c0931bbea9 Mon Sep 17 00:00:00 2001 From: David Ezzio Date: Fri, 8 Aug 2008 19:38:13 +0000 Subject: [PATCH] A little better error handling when an unknown persistence unit is specified in the test case. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@684064 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/persistence/test/PersistenceTestCase.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java index e29e507e6..0511dc33c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/test/PersistenceTestCase.java @@ -123,8 +123,13 @@ public abstract class PersistenceTestCase "jpa(Types=" + buf.toString() + ")"); } - return (OpenJPAEntityManagerFactorySPI) Persistence. - createEntityManagerFactory(pu, map); + OpenJPAEntityManagerFactorySPI oemf = (OpenJPAEntityManagerFactorySPI) + Persistence.createEntityManagerFactory(pu, map); + if (oemf == null) + throw new NullPointerException( + "Expected an entity manager factory " + + "for the persistence unit named: \"" + pu + "\""); + return oemf; } @Override