### Question:
TransformWithMappingMeta extends BaseSerializingMeta<Main, Data> implements ITransformMeta<Main, Data> { public static void replaceVariableValues( IVariables childPipelineMeta, IVariables replaceBy, String type ) { if ( replaceBy == null ) { return; } String[] variableNames = replaceBy.listVariables(); for ( String variableName : variableNames ) { if ( childPipelineMeta.getVariable( variableName ) != null && !isInternalVariable( variableName, type ) ) { childPipelineMeta.setVariable( variableName, replaceBy.getVariable( variableName ) ); } } }  static PipelineMeta loadMappingMeta( TransformWithMappingMeta mappingMeta, IHopMetadataProvider metadataProvider, IVariables variables ); static synchronized PipelineMeta loadMappingMeta( TransformWithMappingMeta executorMeta,
                                                           IHopMetadataProvider metadataProvider, IVariables variables, boolean share ); static void activateParams( IVariables childVariableSpace, INamedParams childNamedParams, IVariables parent, String[] listParameters,
                                     String[] mappingVariables, String[] inputFields ); static void activateParams( IVariables childVariableSpace, INamedParams childNamedParams, IVariables parent, String[] listParameters,
                                     String[] mappingVariables, String[] inputFields, boolean isPassingAllParameters ); String getFilename(); void setFilename( String filename ); void replaceFileName( String fileName ); @Override String exportResources( IVariables variables, Map<String, ResourceDefinition> definitions,
                                 IResourceNaming iResourceNaming,
                                 IHopMetadataProvider metadataProvider ); static void addMissingVariables( IVariables fromSpace, IVariables toSpace ); static void replaceVariableValues( IVariables childPipelineMeta, IVariables replaceBy, String type ); static void replaceVariableValues( IVariables childPipelineMeta, IVariables replaceBy );  }### Answer:
@Test @PrepareForTest( TransformWithMappingMeta.class ) public void replaceVariablesWithJobInternalVariablesTest() { String variableOverwrite = "paramOverwrite"; String variableChildOnly = "childValueVariable"; String[] jobVariables = Const.INTERNAL_WORKFLOW_VARIABLES; IVariables ChildVariables = new Variables(); IVariables 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" ); TransformWithMappingMeta.replaceVariableValues( ChildVariables, replaceByParentVariables ); Assert.assertEquals( "childValue", ChildVariables.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_FOLDER ) ); Assert.assertEquals( "parentNotInternalValue", ChildVariables.getVariable( variableOverwrite ) ); Assert.assertEquals( variableChildOnly, ChildVariables.getVariable( variableChildOnly ) ); }
@Test @PrepareForTest( TransformWithMappingMeta.class ) public void replaceVariablesWithPipelineInternalVariablesTest() { String variableOverwrite = "paramOverwrite"; String variableChildOnly = "childValueVariable"; String[] jobVariables = Const.INTERNAL_PIPELINE_VARIABLES; IVariables ChildVariables = new Variables(); IVariables 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" ); TransformWithMappingMeta.replaceVariableValues( ChildVariables, replaceByParentVariables ); Assert.assertEquals( "childValue", ChildVariables.getVariable( Const.INTERNAL_VARIABLE_ENTRY_CURRENT_FOLDER ) ); Assert.assertEquals( "parentNotInternalValue", ChildVariables.getVariable( variableOverwrite ) ); Assert.assertEquals( variableChildOnly, ChildVariables.getVariable( variableChildOnly ) ); }