Program: 126877
Project: 126877
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;
  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);
    ExtractMetaDataUtils extract=Mockito.mock(ExtractMetaDataUtils.class);
    Mockito.when(ExtractMetaDataUtils.getInstance()).thenReturn(extract);
    Mockito.when(extract.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);
}

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.createConnection((DatabaseConnection)dataProvider)).thenReturn(reConn);
    PowerMockito.mockStatic(ExtractMetaDataUtils.class);
    ExtractMetaDataUtils extract=Mockito.mock(ExtractMetaDataUtils.class);
    Mockito.when(ExtractMetaDataUtils.getInstance()).thenReturn(extract);
    Mockito.when(extract.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.isSchemaHasChildren(dataProvider,schema,tablePattern,DqRepositoryViewService.TABLE_TYPES);
    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);
}