@VisibleForTesting
  Database getDatabase( LoggingObjectInterface parentObject, PGBulkLoaderMeta pgBulkLoaderMeta ) {
    DatabaseMeta dbMeta = pgBulkLoaderMeta.getDatabaseMeta();
    // If dbNameOverride is present, clone the origin db meta and override the DB name
    String dbNameOverride = environmentSubstitute( pgBulkLoaderMeta.getDbNameOverride() );
    if ( !Utils.isEmpty( dbNameOverride ) ) {
      dbMeta = (DatabaseMeta) pgBulkLoaderMeta.getDatabaseMeta().clone();
      dbMeta.setDBName( dbNameOverride.trim() );
      logDebug( "DB name overridden to the value: " + dbNameOverride );
    }
    return new Database( parentObject, dbMeta );
  }
@Test
  public void testDBNameNOTOverridden_IfDbNameOverrideNull() throws Exception {
    // Db Name Override is null
    PGBulkLoaderMeta pgBulkLoaderMock = getPgBulkLoaderMock( null );
    Database database = pgBulkLoader.getDatabase( pgBulkLoader, pgBulkLoaderMock );
    assertNotNull( database );
    // Verify DB name is NOT overridden
    assertEquals( CONNECTION_DB_NAME, database.getDatabaseMeta().getDatabaseName() );
    // Check additionally other connection information
    assertEquals( CONNECTION_NAME, database.getDatabaseMeta().getName() );
    assertEquals( CONNECTION_DB_HOST, database.getDatabaseMeta().getHostname() );
    assertEquals( CONNECTION_DB_PORT, database.getDatabaseMeta().getDatabasePortNumberString() );
    assertEquals( CONNECTION_DB_USERNAME, database.getDatabaseMeta().getUsername() );
    assertEquals( CONNECTION_DB_PASSWORD, database.getDatabaseMeta().getPassword() );
  }