TeraDataBulkLoaderRoutines { @VisibleForTesting String getTargetSchema( boolean isPreview ) { if ( this.meta.getSchemaName() == null || this.meta.getSchemaName().isEmpty() ) { return isPreview ? this.meta.getDbName() : parent.environmentSubstitute( this.meta.getDbName() ); } return isPreview ? this.meta.getSchemaName() : parent.environmentSubstitute( this.meta.getSchemaName() ); } TeraDataBulkLoaderRoutines( TeraDataBulkLoader parent, TeraDataBulkLoaderMeta meta ); String dropTable( boolean isPreview, String user, String suffix ); String createScriptFile(); void createFromExistingScriptFile(); String createGeneratedScriptFile(); String createGeneratedScriptFile( Map<String, Integer> inputFieldTypes, Map<String, Integer> inputFieldLength );  }
@Test public void getTargetSchemaEmptyTest() { when( teraDataBulkLoaderMetaMock.getSchemaName() ).thenReturn( "" ); when( teraDataBulkLoaderMetaMock.getDbName() ).thenReturn( "dbName" ); assertEquals( "dbName", teraDataBulkLoaderRoutines.getTargetSchema( true ) ); }
@Test public void getTargetSchemaTest() { when( teraDataBulkLoaderMetaMock.getSchemaName() ).thenReturn( "schemaName" ); when( teraDataBulkLoaderMetaMock.getDbName() ).thenReturn( "dbName" ); assertEquals( "schemaName", teraDataBulkLoaderRoutines.getTargetSchema( true ) ); }
@Test public void getTargetSchemaNullTest() { when( teraDataBulkLoaderMetaMock.getSchemaName() ).thenReturn( null ); when( teraDataBulkLoaderMetaMock.getDbName() ).thenReturn( "dbName" ); assertEquals( "dbName", teraDataBulkLoaderRoutines.getTargetSchema( true ) ); }