private void updateField( Object[] r ) throws Exception {
    // Loop through fields
    for ( int i = 0; i < data.getFieldnr(); i++ ) {
      // DO CONVERSION OF THE DEFAULT VALUE ...
      // Entered by user
      ValueMetaInterface targetValueMeta = data.getOutputRowMeta().getValueMeta( data.getFieldnrs()[i] );
      ValueMetaInterface sourceValueMeta = data.getConvertRowMeta().getValueMeta( data.getFieldnrs()[i] );

      if ( !Utils.isEmpty( meta.getField( i ).getReplaceMask() ) ) {
        sourceValueMeta.setConversionMask( meta.getField( i ).getReplaceMask() );
      }

      sourceValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL );
      r[data.getFieldnrs()[i]] = targetValueMeta.convertData( sourceValueMeta, data.getRealReplaceByValues()[i] );
      targetValueMeta.setStorageType( ValueMetaInterface.STORAGE_TYPE_NORMAL );
    }
  }
@Test
  public void testUpdateField() throws Exception {
    SetValueConstant step = new SetValueConstant( smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans );

    ValueMetaInterface valueMeta = new ValueMetaString( "Field1" );
    valueMeta.setStorageType( ValueMetaInterface.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.initStepMetaInterface ).getFields();
    doReturn( field ).when( smh.initStepMetaInterface ).getField( 0 );
    doReturn( rowMeta ).when( smh.initStepDataInterface ).getConvertRowMeta();
    doReturn( rowMeta ).when( smh.initStepDataInterface ).getOutputRowMeta();
    doReturn( 1 ).when( smh.initStepDataInterface ).getFieldnr();
    doReturn( new int[] { 0 } ).when( smh.initStepDataInterface ).getFieldnrs();
    doReturn( new String[] { "foo" } ).when( smh.initStepDataInterface ).getRealReplaceByValues();

    step.init( smh.initStepMetaInterface, smh.initStepDataInterface );

    Method m = SetValueConstant.class.getDeclaredMethod( "updateField", Object[].class );
    m.setAccessible( true );

    Object[] row = new Object[] { null };
    m.invoke( step, new Object[] { row } );

    Assert.assertEquals( "foo", valueMeta.getString( row[0] ) );
  }