mirror of https://github.com/apache/openjpa.git
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:
parent
67a73ee0ea
commit
aeafc39d3d
|
@ -107,6 +107,26 @@ public class TestPersistence
|
||||||
em.close();
|
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) {
|
public static void main(String[] args) {
|
||||||
TestRunner.run(TestPersistence.class);
|
TestRunner.run(TestPersistence.class);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue