### Question:
TextFileOutput extends BaseTransform<Meta, Data> implements ITransform<Meta, Data> { public void writeRow( IRowMeta rowMeta, Object[] r ) throws HopTransformException { try { if ( meta.getOutputFields() == null || meta.getOutputFields().length == 0 ) { for ( int i = 0; i < rowMeta.size(); i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } IValueMeta v = rowMeta.getValueMeta( i ); Object valueData = r[ i ]; writeField( v, valueData, null ); } data.writer.write( data.binaryNewline ); } else { for ( int i = 0; i < meta.getOutputFields().length; i++ ) { if ( i > 0 && data.binarySeparator.length > 0 ) { data.writer.write( data.binarySeparator ); } IValueMeta v = rowMeta.getValueMeta( data.fieldnrs[ i ] ); Object valueData = r[ data.fieldnrs[ i ] ]; writeField( v, valueData, data.binaryNullValue[ i ] ); } data.writer.write( data.binaryNewline ); } incrementLinesOutput(); } catch ( Exception e ) { throw new HopTransformException( "Error writing line", e ); } } TextFileOutput( TransformMeta transformMeta, Meta meta, Data data, int copyNr, PipelineMeta pipelineMeta,
                         Pipeline pipeline ); 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(); void writeRow( IRowMeta rowMeta, Object[] r ); String buildFilename( String filename, boolean ziparchive ); @Override boolean init(); @Override void dispose(); boolean containsSeparatorOrEnclosure( byte[] source, byte[] separator, byte[] enclosure );  }### Answer:
@Test public void testFastDumpDisableStreamEncodeTest() throws Exception { String testString = "ÖÜä"; String inputEncode = "UTF-8"; String outputEncode = "Windows-1252"; Object[] rows = { testString.getBytes( inputEncode ) }; ValueMetaBase iValueMeta = new ValueMetaBase( "test", IValueMeta.TYPE_STRING ); iValueMeta.setStringEncoding( inputEncode ); iValueMeta.setStorageType( IValueMeta.STORAGE_TYPE_BINARY_STRING ); iValueMeta.setStorageMetadata( new ValueMetaString() ); TextFileOutputData data = new TextFileOutputData(); data.binarySeparator = " ".getBytes(); data.binaryEnclosure = "\"".getBytes(); data.binaryNewline = "\n".getBytes(); RowMeta rowMeta = new RowMeta(); rowMeta.addValueMeta( iValueMeta ); textFileOutput = new TextFileOutputTestHandler( transformMockHelper.transformMeta, transformMockHelper.iTransformMeta, data, 0, transformMockHelper.pipelineMeta, transformMockHelper.pipeline ); Mockito.doReturn( outputEncode ).when( transformMockHelper.iTransformMeta ).getEncoding(); textFileOutput.getData().writer = Mockito.mock( BufferedOutputStream.class ); textFileOutput.writeRow( rowMeta, rows ); Mockito.verify( textFileOutput.getData().writer ).write( testString.getBytes( outputEncode ) ); }