package org.wamblee.support.persistence; import static junit.framework.Assert.*; import javax.sql.DataSource; import org.junit.After; import org.junit.Before; import org.junit.Test; public class DatabaseUtilsLeakTest { private Database db; private DatabaseUtils dbutils; @Before public void setUp() { db = DatabaseBuilder.getDatabase(); DataSource ds = db.start(); dbutils = new DatabaseUtils(ds); } @After public void tearDown() { db.stop(); } @Test public void testLeak() throws Exception { assertEquals(0, db.getActiveConnections()); dbutils.dropTables(new MyTables()); assertEquals(0, db.getActiveConnections()); } }