Program: 127379
Project: 127379
Buggy source:
@Test public void testIsContainsTableConnectionSchemaString(){
  String schemaName="String_Node_Str";
  String tablePattern=null;
  boolean containsTable=false;
  Connection dataProvider=null;
  DatabaseMetaData metaData=null;
  java.sql.Connection sqlConn=null;
  Schema schema=null;
  String[] tableType=new String[]{TableType.TABLE.toString()};
  ResultSet tables=Mockito.mock(ResultSet.class);
  try {
    Mockito.when(tables.next()).thenReturn(true);
    metaData=Mockito.mock(DatabaseMetaData.class);
    Mockito.when(metaData.getTables(null,schemaName,tablePattern,tableType)).thenReturn(tables);
    dataProvider=Mockito.mock(DatabaseConnection.class);
    TypedReturnCode<java.sql.Connection> reConn=new TypedReturnCode<java.sql.Connection>();
    sqlConn=Mockito.mock(java.sql.Connection.class);
    reConn.setOk(true);
    reConn.setObject(sqlConn);
    Mockito.when(sqlConn.getMetaData()).thenReturn(metaData);
    Mockito.when(sqlConn.isClosed()).thenReturn(true);
    schema=Mockito.mock(Schema.class);
    Mockito.when(schema.getName()).thenReturn(schemaName);
    PowerMockito.mockStatic(MetadataConnectionUtils.class);
    Mockito.when(MetadataConnectionUtils.checkConnection((DatabaseConnection)dataProvider)).thenReturn(reConn);
    PowerMockito.mockStatic(ExtractMetaDataUtils.class);
    Mockito.when(ExtractMetaDataUtils.getDatabaseMetaData(sqlConn,(DatabaseConnection)dataProvider,false)).thenReturn(metaData);
    PowerMockito.mockStatic(PackageHelper.class);
    Mockito.when(PackageHelper.getCatalogOrSchema(schema)).thenReturn(schema);
    Mockito.when(PackageHelper.getParentPackage(schema)).thenReturn(null);
    containsTable=DqRepositoryViewService.isContainsTable(dataProvider,schema,tablePattern);
    Mockito.verify(metaData).getTables(null,schemaName,tablePattern,tableType);
    Mockito.verify(tables).next();
    Mockito.verify(sqlConn).isClosed();
    Mockito.verify(schema).getName();
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail(e.getMessage());
  }
  Mockito.verifyZeroInteractions(metaData,tables,dataProvider,sqlConn,schema);
  assertTrue(containsTable);
}

Fixed version (ground truth):
@Test public void testIsContainsTableConnectionSchemaString(){
  String schemaName="String_Node_Str";
  String tablePattern=null;
  boolean containsTable=false;
  Connection dataProvider=null;
  DatabaseMetaData metaData=null;
  java.sql.Connection sqlConn=null;
  Schema schema=null;
  ResultSet tables=Mockito.mock(ResultSet.class);
  try {
    Mockito.when(tables.next()).thenReturn(true);
    metaData=Mockito.mock(DatabaseMetaData.class);
    Mockito.when(metaData.getTables(null,schemaName,tablePattern,DqRepositoryViewService.TABLE_TYPES)).thenReturn(tables);
    dataProvider=Mockito.mock(DatabaseConnection.class);
    TypedReturnCode<java.sql.Connection> reConn=new TypedReturnCode<java.sql.Connection>();
    sqlConn=Mockito.mock(java.sql.Connection.class);
    reConn.setOk(true);
    reConn.setObject(sqlConn);
    Mockito.when(sqlConn.getMetaData()).thenReturn(metaData);
    Mockito.when(sqlConn.isClosed()).thenReturn(true);
    schema=Mockito.mock(Schema.class);
    Mockito.when(schema.getName()).thenReturn(schemaName);
    PowerMockito.mockStatic(MetadataConnectionUtils.class);
    Mockito.when(MetadataConnectionUtils.checkConnection((DatabaseConnection)dataProvider)).thenReturn(reConn);
    PowerMockito.mockStatic(ExtractMetaDataUtils.class);
    Mockito.when(ExtractMetaDataUtils.getDatabaseMetaData(sqlConn,(DatabaseConnection)dataProvider,false)).thenReturn(metaData);
    PowerMockito.mockStatic(PackageHelper.class);
    Mockito.when(PackageHelper.getCatalogOrSchema(schema)).thenReturn(schema);
    Mockito.when(PackageHelper.getParentPackage(schema)).thenReturn(null);
    containsTable=DqRepositoryViewService.isContainsTable(dataProvider,schema,tablePattern);
    Mockito.verify(metaData).getTables(null,schemaName,tablePattern,DqRepositoryViewService.TABLE_TYPES);
    Mockito.verify(tables).next();
    Mockito.verify(sqlConn).isClosed();
    Mockito.verify(schema).getName();
  }
 catch (  Exception e) {
    e.printStackTrace();
    fail(e.getMessage());
  }
  Mockito.verifyZeroInteractions(metaData,tables,dataProvider,sqlConn,schema);
  assertTrue(containsTable);
}