### Question:
OraBulkLoader extends BaseTransform implements ITransform { public void createControlFile( String filename, Object[] row, OraBulkLoaderMeta meta ) throws HopException { FileWriter fw = null; try { File controlFile = new File( getFileObject( filename, getPipelineMeta() ).getURL().getFile() ); controlFile.getParentFile().mkdirs(); controlFile.createNewFile(); fw = new FileWriter( controlFile ); fw.write( getControlFileContents( meta, getInputRowMeta(), row ) ); } catch ( IOException ex ) { throw new HopException( ex.getMessage(), ex ); } finally { try { if ( fw != null ) { fw.close(); } } catch ( Exception ex ) { } } } 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 testCreateControlFile() throws Exception { String tempTrueControlFilepath = tempControlFile.getAbsolutePath() + "A.txt"; String expectedControlContents = "test"; OraBulkLoaderMeta oraBulkLoaderMeta = mock( OraBulkLoaderMeta.class ); IRowMeta iRowMeta = mock( IRowMeta.class ); Object[] objectRow = {}; doReturn( iRowMeta ).when( oraBulkLoader ).getInputRowMeta(); doReturn( expectedControlContents ).when( oraBulkLoader ).getControlFileContents( oraBulkLoaderMeta, iRowMeta, objectRow ); oraBulkLoader.createControlFile( tempTrueControlFilepath, objectRow, oraBulkLoaderMeta ); assertTrue( Files.exists( Paths.get( tempTrueControlFilepath ) ) ); File tempTrueControlFile = new File( tempTrueControlFilepath ); String tempTrueControlFileContents = new String( Files.readAllBytes( tempTrueControlFile.toPath() ) ); assertEquals( expectedControlContents, tempTrueControlFileContents ); tempTrueControlFile.delete(); }