@Test(expected = CayenneRuntimeException.class)
  public void testConstructor() throws Exception {
    Driver driver = objectFactory.newInstance(Driver.class, dataSourceInfo.getJdbcDriver());
    DriverDataSource nonPooling =
        new DriverDataSource(
            driver,
            dataSourceInfo.getDataSourceUrl(),
            dataSourceInfo.getUserName(),
            dataSourceInfo.getPassword());

    PoolingDataSourceParameters poolParameters = createParameters();
    UnmanagedPoolingDataSource ds = new UnmanagedPoolingDataSource(nonPooling, poolParameters);

    // the exception should happen in the line above... this line is to
    // prevent compiler warnings
    ds.close();
  }
  @Before
  public void before() throws SQLException {

    this.mockConnections = new Connection[4];
    for (int i = 0; i < mockConnections.length; i++) {
      mockConnections[i] = mock(Connection.class);
    }

    this.mockPoolingDataSource = mock(UnmanagedPoolingDataSource.class);
    when(mockPoolingDataSource.getConnection())
        .thenReturn(mockConnections[0], mockConnections[1], mockConnections[2], mockConnections[3]);

    this.dataSource = new ManagedPoolingDataSource(mockPoolingDataSource);
  }