public static void replaceVariableValues( VariableSpace childTransMeta, VariableSpace replaceBy, String type ) {
    if ( replaceBy == null ) {
      return;
    }
    String[] variableNames = replaceBy.listVariables();
    for ( String variableName : variableNames ) {
      if ( childTransMeta.getVariable( variableName ) != null && !isInternalVariable( variableName, type ) ) {
        childTransMeta.setVariable( variableName, replaceBy.getVariable( variableName ) );
      }
    }
  }
@Test
  public void replaceVariablesWithJobInternalVariablesTest()  {
    String variableOverwrite = "paramOverwrite";
    String variableChildOnly = "childValueVariable";
    String [] jobVariables = Const.INTERNAL_JOB_VARIABLES;
    VariableSpace ChildVariables = new Variables();
    VariableSpace replaceByParentVariables = new Variables();

    for ( String internalVariable : jobVariables ) {
      ChildVariables.setVariable( internalVariable, "childValue" );
      replaceByParentVariables.setVariable( internalVariable, "parentValue" );
    }

    ChildVariables.setVariable( variableChildOnly, "childValueVariable" );
    ChildVariables.setVariable( variableOverwrite, "childNotInternalValue" );
    replaceByParentVariables.setVariable( variableOverwrite, "parentNotInternalValue" );

    StepWithMappingMeta.replaceVariableValues( ChildVariables, replaceByParentVariables );
    // do not replace internal variables
    Assert.assertEquals( "childValue", ChildVariables.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY ) );
    // replace non internal variables
    Assert.assertEquals( "parentNotInternalValue", ChildVariables.getVariable( variableOverwrite ) );
    // keep child only variables
    Assert.assertEquals( variableChildOnly, ChildVariables.getVariable( variableChildOnly ) );

  }