@@ -0,0 +1,1035 @@
+package beaform.dao;%0A%0Aimport static org.junit.Assert.assertFalse;%0A%0Aimport java.util.concurrent.CountDownLatch;%0A%0Aimport javax.persistence.EntityManager;%0Aimport javax.persistence.EntityManagerFactory;%0Aimport javax.persistence.Persistence;%0A%0Aimport org.junit.Test;%0A%0A@SuppressWarnings(%22static-method%22)%0Apublic class ShutDownHookTest %7B%0A%0A%09@Test%0A%09public void testHook() throws InterruptedException %7B%0A%09%09EntityManagerFactory entityManagerFact = Persistence.createEntityManagerFactory(%22test%22);%0A%09%09EntityManager entityManager = entityManagerFact.createEntityManager();%0A%09%09ShutDownHook hook = new ShutDownHook(entityManager, entityManagerFact);%0A%09%09CountDownLatch latch = new CountDownLatch(1);%0A%0A%09%09Runnable withsync = new Runnable() %7B%0A%0A%09%09%09@Override%0A%09%09%09public void run() %7B%0A%09%09%09%09hook.run();%0A%09%09%09%09latch.countDown();%0A%09%09%09%7D%0A%09%09%7D;%0A%09%09Thread thread = new Thread(withsync);%0A%09%09thread.start();%0A%09%09latch.await();%0A%09%09assertFalse(%22Entity manager isn't closed%22, entityManager.isOpen());%0A%09%09assertFalse(%22Entity manager factory isn't closed%22, entityManagerFact.isOpen());%0A%09%7D%0A%7D%0A

Add test for the shutdown hook