Program: 85534
Project: 85534
Buggy source:
/** 
 * Verify adjustment of connection count limits. </p> 1) Test initial limit </p> 2) Test limit increase </p> 3) Test decrease below current checkout </p> 4) Verify handling of illegal values
 */
@Test public void testMaxConnections() throws Exception {
  ManagedDataSource dataSource=new MockManagedDataSource(1,new Duration(1,MILLISECONDS));
  assertEquals(dataSource.getMaxConnections(),1);
  Queue<Connection> connections=new LinkedList<Connection>();
  connections.add(dataSource.getConnection());
  assertEquals(dataSource.getConnectionsActive(),1);
  try {
    dataSource.getConnection();
    fail("String_Node_Str");
  }
 catch (  SQLException expected) {
  }
  assertEquals(dataSource.getConnectionsActive(),1);
  dataSource.setMaxConnections(3);
  assertEquals(dataSource.getMaxConnections(),3);
  connections.add(dataSource.getConnection());
  connections.add(dataSource.getConnection());
  try {
    dataSource.getConnection();
    fail("String_Node_Str");
  }
 catch (  SQLException expected) {
  }
  assertEquals(dataSource.getConnectionsActive(),3);
  dataSource.setMaxConnections(2);
  assertEquals(dataSource.getMaxConnections(),2);
  assertEquals(dataSource.getConnectionsActive(),3);
  try {
    dataSource.getConnection();
    fail("String_Node_Str");
  }
 catch (  SQLException expected) {
  }
  assertEquals(dataSource.getConnectionsActive(),3);
  connections.remove().close();
  assertEquals(dataSource.getConnectionsActive(),2);
  try {
    dataSource.getConnection();
    fail("String_Node_Str");
  }
 catch (  SQLException expected) {
  }
  assertEquals(dataSource.getConnectionsActive(),2);
  connections.remove().close();
  connections.add(dataSource.getConnection());
  assertEquals(dataSource.getConnectionsActive(),2);
  try {
    dataSource.setMaxConnectionWaitMillis(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
  assertEquals(dataSource.getMaxConnections(),2);
  try {
    dataSource.setMaxConnectionWaitMillis(new Duration(0,MILLISECONDS));
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException e) {
  }
  assertEquals(dataSource.getMaxConnections(),2);
  for (  Connection connection : connections) {
    connection.close();
  }
  assertEquals(dataSource.getConnectionsActive(),0);
}

Fixed version (ground truth):
/** 
 * Verify adjustment of connection count limits. <ol> <li>Test initial limit</li> <li>Test limit increase</li> <li>Test decrease below current checkout</li> <li>Verify handling of illegal values</li> </ol>
 */
@Test public void testMaxConnections() throws Exception {
  ManagedDataSource dataSource=new MockManagedDataSource(1,new Duration(1,MILLISECONDS));
  assertEquals(dataSource.getMaxConnections(),1);
  Queue<Connection> connections=new LinkedList<Connection>();
  connections.add(dataSource.getConnection());
  assertEquals(dataSource.getConnectionsActive(),1);
  try {
    dataSource.getConnection();
    fail("String_Node_Str");
  }
 catch (  SQLException expected) {
  }
  assertEquals(dataSource.getConnectionsActive(),1);
  dataSource.setMaxConnections(3);
  assertEquals(dataSource.getMaxConnections(),3);
  connections.add(dataSource.getConnection());
  connections.add(dataSource.getConnection());
  try {
    dataSource.getConnection();
    fail("String_Node_Str");
  }
 catch (  SQLException expected) {
  }
  assertEquals(dataSource.getConnectionsActive(),3);
  dataSource.setMaxConnections(2);
  assertEquals(dataSource.getMaxConnections(),2);
  assertEquals(dataSource.getConnectionsActive(),3);
  try {
    dataSource.getConnection();
    fail("String_Node_Str");
  }
 catch (  SQLException expected) {
  }
  assertEquals(dataSource.getConnectionsActive(),3);
  connections.remove().close();
  assertEquals(dataSource.getConnectionsActive(),2);
  try {
    dataSource.getConnection();
    fail("String_Node_Str");
  }
 catch (  SQLException expected) {
  }
  assertEquals(dataSource.getConnectionsActive(),2);
  connections.remove().close();
  connections.add(dataSource.getConnection());
  assertEquals(dataSource.getConnectionsActive(),2);
  try {
    dataSource.setMaxConnectionWaitMillis(null);
    fail("String_Node_Str");
  }
 catch (  NullPointerException e) {
  }
  assertEquals(dataSource.getMaxConnections(),2);
  try {
    dataSource.setMaxConnectionWaitMillis(new Duration(0,MILLISECONDS));
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException e) {
  }
  assertEquals(dataSource.getMaxConnections(),2);
  for (  Connection connection : connections) {
    connection.close();
  }
  assertEquals(dataSource.getConnectionsActive(),0);
}