### Question:
TextFileOutput extends BaseTransform<Meta, Data> implements ITransform<Meta, Data> { protected boolean writeEndedLine() { boolean retval = false; try { String sLine = environmentSubstitute( meta.getEndedLine() ); if ( sLine != null ) { if ( sLine.trim().length() > 0 ) { data.writer.write( getBinaryString( sLine ) ); incrementLinesOutput(); } } } catch ( Exception e ) { logError( "Error writing ended tag line: " + e.toString() ); logError( Const.getStackTracker( e ) ); retval = true; } return retval; } 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 testEndedLineVar() throws Exception { TextFileOutputData data = new TextFileOutputData(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); data.writer = baos; TextFileOutputMeta meta = new TextFileOutputMeta(); meta.setEndedLine( "${endvar}" ); meta.setDefault(); meta.setEncoding( "UTF-8" ); transformMockHelper.transformMeta.setTransform( meta ); TextFileOutput textFileOutput = new TextFileOutputTestHandler( transformMockHelper.transformMeta, meta, data, 0, transformMockHelper.pipelineMeta, transformMockHelper.pipeline ); textFileOutput.setVariable( "endvar", "this is the end" ); textFileOutput.writeEndedLine(); assertEquals( "this is the end", baos.toString( "UTF-8" ) ); }