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
This commit is contained in:
David Ezzio 2008-08-08 19:38:13 +00:00
parent 352d799756
commit e5a363e651
1 changed files with 7 additions and 2 deletions

View File

@ -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