### Question:
DatabaseConnection { @SuppressWarnings("deprecation") public void dispose() { SQLUtil.closeQuietly(nativeConn); } DatabaseConnection();  DatabaseConnection(final Connection conn); @SuppressWarnings("deprecation") void dispose(); void test(); Connection getConnection(); void setConnection(final Connection connection); PreparedStatement prepareStatement(final String sql, final List<SQLParam> params); PreparedStatement prepareStatement(DatabaseQueryBuilder query); CallableStatement prepareCall(final String sql, final List<SQLParam> params); void commit();  }### Answer:
@Test public void testDispose() { ExpectProxy<Connection> tp = new ExpectProxy<Connection>(); tp.expectAndReturn("isClosed", Boolean.FALSE); tp.expect("close"); Connection xc = tp.getProxy(Connection.class); DatabaseConnection dbc = new DatabaseConnection(xc); dbc.dispose(); assertTrue("close called", tp.isDone()); tp = new ExpectProxy<Connection>(); xc = tp.getProxy(Connection.class); tp.expectAndReturn("isClosed", Boolean.TRUE); dbc = new DatabaseConnection(xc); dbc.dispose(); assertTrue("close called", tp.isDone()); }