MockControl connectionFactoryControl = MockControl.createStrictControl(ConnectionFactory.class);
ConnectionFactory connectionFactory = (ConnectionFactory) connectionFactoryControl.getMock();
MockControl connectionControl = MockControl.createStrictControl(Connection.class);
Connection connection = (Connection) connectionControl.getMock();
MockControl connectionCallbackControl = MockControl.createStrictControl(ConnectionCallback.class);
ConnectionCallback connectionCallback = (ConnectionCallback) connectionCallbackControl.getMock();
Object obj = new Object();
connectionFactory.getConnection();
connectionFactoryControl.setReturnValue(connection);
connectionCallback.doInConnection(connection, connectionFactory);
connectionCallbackControl.setReturnValue(obj);
connection.close();
connectionControl.setVoidCallable(1);