### Question:
OraBulkLoader extends BaseTransform implements ITransform { public void.dispose() { meta = (OraBulkLoaderMeta) smi; data = (OraBulkLoaderData) sdi; super.dispose(); if ( output != null ) { try { output.close(); } catch ( IOException e ) { logError( "Error while closing output", e ); } output = null; } if ( sqlldrProcess != null ) { try { int exitVal = sqlldrProcess.waitFor(); sqlldrProcess = null; logBasic( BaseMessages.getString( PKG, "OraBulkLoader.Log.ExitValueSqlldr", "" + exitVal ) ); } catch ( InterruptedException e ) { e.printStackTrace(); if ( sqlldrProcess != null ) { sqlldrProcess.destroy(); } } } if ( !preview && meta.isEraseFiles() ) { FileObject fileObject = null; String method = meta.getLoadMethod(); if ( OraBulkLoaderMeta.METHOD_AUTO_END.equals( method ) ) { if ( meta.getControlFile() != null ) { try { fileObject = getFileObject( meta.getControlFile(), getPipelineMeta() ); fileObject.delete(); fileObject.close(); } catch ( Exception ex ) { logError( "Error deleting control file \'" + getFilename( fileObject ) + "\': " + ex.getMessage(), ex ); } } } if ( OraBulkLoaderMeta.METHOD_AUTO_END.equals( method ) ) { if ( meta.getDataFile() != null ) { try { fileObject = getFileObject( meta.getDataFile(), getPipelineMeta() ); fileObject.delete(); fileObject.close(); } catch ( Exception ex ) { logError( "Error deleting data file \'" + getFilename( fileObject ) + "\': " + ex.getMessage(), ex ); } } } if ( OraBulkLoaderMeta.METHOD_MANUAL.equals( method ) ) { logBasic( "Deletion of files is not compatible with \'manual load method\'" ); } } } OraBulkLoader( TransformMeta transformMeta, ITransformData data, int copyNr, PipelineMeta pipelineMeta,
                        Pipeline pipeline ); String getControlFileContents( OraBulkLoaderMeta meta, IRowMeta rm, Object[] r ); void createControlFile( String filename, Object[] row, OraBulkLoaderMeta meta ); String createCommandLine( OraBulkLoaderMeta meta, boolean password ); void checkExitVal( int exitVal ); boolean execute( OraBulkLoaderMeta meta, boolean wait ); boolean processRow(); boolean init(); void dispose(); static final int EX_SUCC; static final int EX_WARN; }### Answer:
@Test public void testDispose() throws Exception { PipelineMeta pipelineMeta = spy( new PipelineMeta() ); OraBulkLoaderData oraBulkLoaderData = new OraBulkLoaderData(); OraBulkLoaderMeta oraBulkLoaderMeta = new OraBulkLoaderMeta(); oraBulkLoaderMeta.setDataFile( tempDataVfsFilepath ); oraBulkLoaderMeta.setControlFile( tempControlVfsFilepath ); oraBulkLoaderMeta.setEraseFiles( true ); oraBulkLoaderMeta.setLoadMethod( "AUTO_END" ); assertTrue( Files.exists( Paths.get( tempControlFilepath ) ) ); assertTrue( Files.exists( Paths.get( tempDataFilepath ) ) ); doReturn( pipelineMeta ).when( oraBulkLoader ).getPipelineMeta(); oraBulkLoader.dispose(); assertFalse( Files.exists( Paths.get( tempControlFilepath ) ) ); assertFalse( Files.exists( Paths.get( tempDataFilepath ) ) ); }