### Question:
SetValueConstant extends BaseTransform<SetValueConstantMeta, SetValueConstantData> implements ITransform<SetValueConstantMeta, SetValueConstantData> { private void updateField( Object[] r ) throws Exception { for ( int i = 0; i < data.getFieldnr(); i++ ) { IValueMeta targetValueMeta = data.getOutputRowMeta().getValueMeta( data.getFieldnrs()[ i ] ); IValueMeta sourceValueMeta = data.getConvertRowMeta().getValueMeta( data.getFieldnrs()[ i ] ); if ( !Utils.isEmpty( meta.getField( i ).getReplaceMask() ) ) { sourceValueMeta.setConversionMask( meta.getField( i ).getReplaceMask() ); } sourceValueMeta.setStorageType( IValueMeta.STORAGE_TYPE_NORMAL ); r[ data.getFieldnrs()[ i ] ] = targetValueMeta.convertData( sourceValueMeta, data.getRealReplaceByValues()[ i ] ); targetValueMeta.setStorageType( IValueMeta.STORAGE_TYPE_NORMAL ); } } SetValueConstant( TransformMeta transformMeta, SetValueConstantMeta meta, SetValueConstantData data, int copyNr, PipelineMeta pipelineMeta,
                           Pipeline pipeline ); boolean processRow(); boolean init();  }### Answer:
@Test public void testUpdateField() throws Exception { SetValueConstant transform = new SetValueConstant( smh.transformMeta, smh.iTransformMeta, smh.iTransformData, 0, smh.pipelineMeta, smh.pipeline ); IValueMeta valueMeta = new ValueMetaString( "Field1" ); valueMeta.setStorageType( IValueMeta.STORAGE_TYPE_BINARY_STRING ); RowMeta rowMeta = new RowMeta(); rowMeta.addValueMeta( valueMeta ); SetValueConstantMeta.Field field = new SetValueConstantMeta.Field(); field.setFieldName( "Field Name" ); field.setEmptyString( true ); field.setReplaceMask( "Replace Mask" ); field.setReplaceValue( "Replace Value" ); doReturn( Collections.singletonList( field ) ).when( smh.iTransformMeta ).getFields(); doReturn( field ).when( smh.iTransformMeta ).getField( 0 ); doReturn( rowMeta ).when( smh.iTransformData ).getConvertRowMeta(); doReturn( rowMeta ).when( smh.iTransformData ).getOutputRowMeta(); doReturn( 1 ).when( smh.iTransformData ).getFieldnr(); doReturn( new int[] { 0 } ).when( smh.iTransformData ).getFieldnrs(); doReturn( new String[] { "foo" } ).when( smh.iTransformData ).getRealReplaceByValues(); transform.init(); Method m = SetValueConstant.class.getDeclaredMethod( "updateField", Object[].class ); m.setAccessible( true ); Object[] row = new Object[] { null }; m.invoke( transform, new Object[] { row } ); Assert.assertEquals( "foo", valueMeta.getString( row[ 0 ] ) ); }