### Question:
TextFileOutput extends BaseStep implements StepInterface { protected boolean closeFile( String filename ) { try { data.getFileStreamsCollection().closeFile( filename ); } catch ( Exception e ) { logError( "Exception trying to close file: " + e.toString() ); setErrors( 1 ); return false; } return true; } TextFileOutput( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta,
      Trans trans ); boolean isFileExists( String filename ); void initFileStreamWriter( String filename ); String getOutputFileName( Object[] row ); int getFlushInterval(  ); int getMaxOpenFiles(  ); boolean isWriteHeader( String filename ); void flushOpenFiles( boolean closeAfterFlush ); synchronized boolean processRow( StepMetaInterface smi, StepDataInterface sdi ); void writeRow( RowMetaInterface rowMeta, Object[] r ); String buildFilename( String filename, boolean ziparchive ); boolean init( StepMetaInterface smi, StepDataInterface sdi ); void dispose( StepMetaInterface smi, StepDataInterface sdi ); boolean containsSeparatorOrEnclosure( byte[] source, byte[] separator, byte[] enclosure ); public TextFileOutputMeta meta; public TextFileOutputData data; }### Answer:
@Test public void testCloseFileDataOutIsNullCase() { textFileOutput = new TextFileOutput( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); textFileOutput.data = Mockito.mock( TextFileOutputData.class ); Assert.assertNull( textFileOutput.data.out ); textFileOutput.closeFile(); }
@Test public void testCloseFileDataOutIsNotNullCase() throws IOException { textFileOutput = new TextFileOutput( stepMockHelper.stepMeta, stepMockHelper.stepDataInterface, 0, stepMockHelper.transMeta, stepMockHelper.trans ); textFileOutput.data = Mockito.mock( TextFileOutputData.class ); textFileOutput.data.out = Mockito.mock( CompressionOutputStream.class ); textFileOutput.closeFile(); Assert.assertNull( textFileOutput.data.out ); }