### Question:
ReplaceString extends BaseTransform<ReplaceStringMeta, ReplaceStringData> implements ITransform<ReplaceStringMeta, ReplaceStringData> { synchronized Object[] getOneRow( IRowMeta rowMeta, Object[] row ) throws HopException { Object[] rowData = RowDataUtil.resizeArray( row, data.outputRowMeta.size() ); int index = 0; Set<Integer> numFieldsAlreadyBeenTransformed = new HashSet<Integer>(); for ( int i = 0; i < data.numFields; i++ ) { IRowMeta currentRowMeta = ( numFieldsAlreadyBeenTransformed.contains( data.inStreamNrs[ i ] ) ) ? data.outputRowMeta : getInputRowMeta(); String value = replaceString( currentRowMeta.getString( rowData, data.inStreamNrs[ i ] ), data.patterns[ i ], getResolvedReplaceByString( i, row ) ); if ( Utils.isEmpty( data.outStreamNrs[ i ] ) ) { rowData[ data.inStreamNrs[ i ] ] = value; numFieldsAlreadyBeenTransformed.add( data.inStreamNrs[ i ] ); } else { rowData[ data.inputFieldsNr + index++ ] = value; } } return rowData; } ReplaceString( TransformMeta transformMeta, ReplaceStringMeta meta, ReplaceStringData data, int copyNr, PipelineMeta pipelineMeta,
                        Pipeline pipeline ); static String replaceString( String originalString, Pattern pattern, String replaceByString ); boolean processRow(); boolean init(); void dispose();  }### Answer:
@Test public void testGetOneRow() throws Exception { ReplaceStringData data = new ReplaceStringData(); ReplaceStringMeta meta = new ReplaceStringMeta(); ReplaceString replaceString = new ReplaceString( transformMockHelper.transformMeta, meta, data, 0, transformMockHelper.pipelineMeta, transformMockHelper.pipeline ); IRowMeta inputRowMeta = new RowMeta(); inputRowMeta.addValueMeta( 0, new ValueMetaString( "SomeDataMeta" ) ); inputRowMeta.addValueMeta( 1, new ValueMetaString( "AnotherDataMeta" ) ); replaceString.init(); replaceString.setInputRowMeta( inputRowMeta ); data.outputRowMeta = inputRowMeta; data.outputRowMeta.addValueMeta( new ValueMetaString( "AnotherDataMeta" ) ); data.inputFieldsNr = 2; data.numFields = 2; data.inStreamNrs = new int[] { 1, 1 }; data.patterns = new Pattern[] { Pattern.compile( "a" ), Pattern.compile( "t" ) }; data.replaceFieldIndex = new int[] { -1, -1 }; data.outStreamNrs = new String[] { "", "1" }; data.replaceByString = new String[] { "1", "2" }; data.setEmptyString = new boolean[] { false, false }; Object[] output = replaceString.getOneRow( inputRowMeta, row ); assertArrayEquals( "Output varies", expectedRow, output ); }