### Question:
PGBulkLoader extends BaseTransform<PGBulkLoaderMeta, PGBulkLoaderData> implements ITransform<PGBulkLoaderMeta, PGBulkLoaderData> { @VisibleForTesting Database getDatabase( ILoggingObject parentObject, PGBulkLoaderMeta pgBulkLoaderMeta ) { DatabaseMeta dbMeta = pgBulkLoaderMeta.getDatabaseMeta(); 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 ); } PGBulkLoader( TransformMeta transformMeta, PGBulkLoaderMeta meta, PGBulkLoaderData data, int copyNr, PipelineMeta pipelineMeta,
                       Pipeline pipeline ); String getCopyCommand(); boolean processRow(); boolean init();  }### Answer:
@Test public void testDBNameOverridden_IfDbNameOverrideSetUp() throws Exception { PGBulkLoaderMeta pgBulkLoaderMock = getPgBulkLoaderMock( DB_NAME_OVVERRIDE ); Database database = pgBulkLoader.getDatabase( pgBulkLoader, pgBulkLoaderMock ); assertNotNull( database ); assertEquals( DB_NAME_OVVERRIDE, database.getDatabaseMeta().getDatabaseName() ); assertEquals( CONNECTION_NAME, database.getDatabaseMeta().getName() ); assertEquals( CONNECTION_DB_HOST, database.getDatabaseMeta().getHostname() ); assertEquals( CONNECTION_DB_PORT, database.getDatabaseMeta().getPort() ); assertEquals( CONNECTION_DB_USERNAME, database.getDatabaseMeta().getUsername() ); assertEquals( CONNECTION_DB_PASSWORD, database.getDatabaseMeta().getPassword() ); }
@Test public void testDBNameNOTOverridden_IfDbNameOverrideEmpty() throws Exception { PGBulkLoaderMeta pgBulkLoaderMock = getPgBulkLoaderMock( DB_NAME_EMPTY ); Database database = pgBulkLoader.getDatabase( pgBulkLoader, pgBulkLoaderMock ); assertNotNull( database ); assertEquals( CONNECTION_DB_NAME, database.getDatabaseMeta().getDatabaseName() ); assertEquals( CONNECTION_NAME, database.getDatabaseMeta().getName() ); assertEquals( CONNECTION_DB_HOST, database.getDatabaseMeta().getHostname() ); assertEquals( CONNECTION_DB_PORT, database.getDatabaseMeta().getPort() ); assertEquals( CONNECTION_DB_USERNAME, database.getDatabaseMeta().getUsername() ); assertEquals( CONNECTION_DB_PASSWORD, database.getDatabaseMeta().getPassword() ); }
@Test public void testDBNameNOTOverridden_IfDbNameOverrideNull() throws Exception { PGBulkLoaderMeta pgBulkLoaderMock = getPgBulkLoaderMock( null ); Database database = pgBulkLoader.getDatabase( pgBulkLoader, pgBulkLoaderMock ); assertNotNull( database ); assertEquals( CONNECTION_DB_NAME, database.getDatabaseMeta().getDatabaseName() ); assertEquals( CONNECTION_NAME, database.getDatabaseMeta().getName() ); assertEquals( CONNECTION_DB_HOST, database.getDatabaseMeta().getHostname() ); assertEquals( CONNECTION_DB_PORT, database.getDatabaseMeta().getPort() ); assertEquals( CONNECTION_DB_USERNAME, database.getDatabaseMeta().getUsername() ); assertEquals( CONNECTION_DB_PASSWORD, database.getDatabaseMeta().getPassword() ); }