Simple test for OPENJPA-116. Just modified the simple TestPersistence testcase with a new variation for testing the exception on getDelegate() when the EM is closed.

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@501955 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kevin W. Sutter 2007-01-31 19:27:11 +00:00
parent 67a73ee0ea
commit aeafc39d3d
1 changed files with 134 additions and 114 deletions

View File

@ -107,6 +107,26 @@ public class TestPersistence
em.close();
}
/**
* Ensures that an IllegalStateException is thrown if getDelegate is called
* after closing the EntityManager.
*/
public void testGetDelegateAfterClose() {
EntityManager em = emf.createEntityManager();
em.close();
try {
Object o = em.getDelegate();
fail();
}
catch(IllegalStateException ise) {
/*
* An IllegalStateException is expected. Nothing to do here.
*/
}
}
public static void main(String[] args) {
TestRunner.run(TestPersistence.class);
}