### Question:
TableOutput extends BaseTransform<TableOutputMeta, TableOutputData> implements ITransform<TableOutputMeta, TableOutputData> { public boolean init(){ if ( super.init() ) { try { data.commitSize = Integer.parseInt( environmentSubstitute( meta.getCommitSize() ) ); data.databaseMeta = meta.getDatabaseMeta(); IDatabase dbInterface = data.databaseMeta.getIDatabase(); data.useSafePoints = data.databaseMeta.getIDatabase().useSafePoints() && getTransformMeta().isDoingErrorHandling(); data.releaseSavepoint = dbInterface.releaseSavepoint(); data.batchMode = meta.useBatchUpdate() && data.commitSize > 0 && !meta.isReturningGeneratedKeys() && !data.useSafePoints; if ( getTransformMeta().isDoingErrorHandling() && !dbInterface.supportsErrorHandlingOnBatchUpdates() ) { log.logMinimal( BaseMessages.getString( PKG, "TableOutput.Warning.ErrorHandlingIsNotFullySupportedWithBatchProcessing" ) ); } if ( meta.getDatabaseMeta() == null ) { throw new HopException( BaseMessages.getString( PKG, "TableOutput.Exception.DatabaseNeedsToBeSelected" ) ); } if ( meta.getDatabaseMeta() == null ) { logError( BaseMessages.getString( PKG, "TableOutput.Init.ConnectionMissing", getTransformName() ) ); return false; } if ( !dbInterface.supportsStandardTableOutput() ) { throw new HopException( dbInterface.getUnsupportedTableOutputMessage() ); } data.db = new Database( this, meta.getDatabaseMeta() ); data.db.shareVariablesWith( this ); data.db.connect( getPartitionId() ); if ( log.isBasic() ) { logBasic( "Connected to database [" + meta.getDatabaseMeta() + "] (commit=" + data.commitSize + ")" ); } if ( data.commitSize == 0 ) { data.commitSize = Integer.MAX_VALUE; } data.db.setCommit( data.commitSize ); if ( !meta.isPartitioningEnabled() && !meta.isTableNameInField() ) { data.tableName = environmentSubstitute( meta.getTableName() ); } return true; } catch ( HopException e ) { logError( "An error occurred intialising this transform: " + e.getMessage() ); stopAll(); setErrors( 1 ); } } return false; } TableOutput( TransformMeta transformMeta, TableOutputMeta meta, TableOutputData data, int copyNr, PipelineMeta pipelineMeta,
                      Pipeline pipeline ); boolean processRow(); boolean isRowLevel(); boolean init(); void dispose();  }### Answer:
@Test public void testInit_unsupportedConnection() { IDatabase dbInterface = mock( IDatabase.class ); doNothing().when( tableOutputSpy ).logError( anyString() ); when( tableOutputMeta.getCommitSize() ).thenReturn( "1" ); when( tableOutputMeta.getDatabaseMeta() ).thenReturn( databaseMeta ); when( databaseMeta.getIDatabase() ).thenReturn( dbInterface ); String unsupportedTableOutputMessage = "unsupported exception"; when( dbInterface.getUnsupportedTableOutputMessage() ).thenReturn( unsupportedTableOutputMessage ); when( dbInterface.supportsStandardTableOutput() ).thenReturn( false ); tableOutputSpy.init(); HopException ke = new HopException( unsupportedTableOutputMessage ); verify( tableOutputSpy, times( 1 ) ).logError( "An error occurred intialising this transform: " + ke.getMessage() ); }