### Question:
DatabaseConnection { public void test() { try { getConnection().setAutoCommit(!getConnection().getAutoCommit()); getConnection().setAutoCommit(!getConnection().getAutoCommit()); commit(); LOG.ok("connection tested"); } catch (Exception e) { SQLUtil.rollbackQuietly(getConnection()); throw ConnectorException.wrap(e); } } 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 testTest() { ExpectProxy<Connection> tp = new ExpectProxy<Connection>(); tp.expectAndReturn("getAutoCommit", Boolean.FALSE); tp.expect("setAutoCommit"); tp.expectAndReturn("getAutoCommit", Boolean.TRUE); tp.expect("setAutoCommit"); tp.expect("commit"); DatabaseConnection dbc = new DatabaseConnection(tp.getProxy(Connection.class)); dbc.test(); assertTrue("test called", tp.isDone()); }