BoneCPConnectionProvider implements ConnectionProvider,Configurable,Stoppable { public Connection getConnection() throws SQLException { Connection connection = this.pool.getConnection(); try { if ((this.isolation != null) && (connection.getTransactionIsolation() != this.isolation.intValue())) { connection.setTransactionIsolation (this.isolation.intValue()); } if ( connection.getAutoCommit() != this.autocommit ){ connection.setAutoCommit(this.autocommit); } return connection; } catch (SQLException e){ try { connection.close(); } catch (Exception e2) { logger.warn("Setting connection properties failed and closing this connection failed again", e); } throw e; } }  void closeConnection(Connection conn); void configure(Properties props); Connection getConnection(); boolean supportsAggressiveRelease(); ClassLoader getClassLoader(); void setClassLoader(ClassLoader classLoader); @Override @SuppressWarnings("rawtypes") boolean isUnwrappableAs(Class unwrapType); @SuppressWarnings("unchecked") @Override T unwrap(Class<T> unwrapType); @SuppressWarnings({ "unchecked", "rawtypes" }) @Override void configure(Map configurationValues); @Override void stop(); void close();  }
@Test public void testGetConnection() throws SQLException, SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { Field field = testClass.getClass().getDeclaredField("autocommit"); field.setAccessible(true); field.set(testClass, true); field = testClass.getClass().getDeclaredField("isolation"); field.setAccessible(true); field.set(testClass, 8); expect(mockPool.getConnection()).andReturn(mockConnection).once(); expect(mockConnection.getAutoCommit()).andReturn(false).once(); expect(mockConnection.getTransactionIsolation()).andReturn(0).once(); mockConnection.setTransactionIsolation(8); expectLastCall().once(); replay(mockPool, mockConnection); testClass.getConnection(); verify(mockPool, mockConnection); }