### Question:
StepWithMappingMeta extends BaseSerializingMeta implements HasRepositoryDirectories, StepMetaInterface { @Override public String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository, IMetaStore metaStore ) throws KettleException { try { TransMeta mappingTransMeta = loadMappingMeta( this, repository, metaStore, space ); String proposedNewFilename = mappingTransMeta.exportResources( mappingTransMeta, definitions, resourceNamingInterface, repository, metaStore ); String newFilename = "${" + INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}/" + proposedNewFilename; mappingTransMeta.setFilename( newFilename ); mappingTransMeta.setRepositoryDirectory( new RepositoryDirectory() ); replaceFileName( newFilename ); setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME ); return proposedNewFilename; } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "StepWithMappingMeta.Exception.UnableToLoadTrans", fileName ) ); } }  static TransMeta loadMappingMeta( StepWithMappingMeta mappingMeta, Repository rep,
                                           IMetaStore metaStore, VariableSpace space ); static synchronized TransMeta loadMappingMeta( StepWithMappingMeta executorMeta, Repository rep,
                                                        IMetaStore metaStore, VariableSpace space, boolean share ); static void activateParams( VariableSpace childVariableSpace, NamedParams childNamedParams, VariableSpace parent, String[] listParameters,
                                     String[] mappingVariables, String[] inputFields ); ObjectLocationSpecificationMethod getSpecificationMethod(); @Override ObjectLocationSpecificationMethod[] getSpecificationMethods(); void setSpecificationMethod( ObjectLocationSpecificationMethod specificationMethod ); String getDirectoryPath(); void setDirectoryPath( String directoryPath ); @Override String[] getDirectories(); @Override void setDirectories( String[] directories ); String getFileName(); void setFileName( String fileName ); void replaceFileName( String fileName ); String getTransName(); void setTransName( String transName ); ObjectId getTransObjectId(); void setTransObjectId( ObjectId transObjectId ); @Override String exportResources( VariableSpace space, Map<String, ResourceDefinition> definitions,
                                 ResourceNamingInterface resourceNamingInterface, Repository repository,
                                 IMetaStore metaStore ); static void addMissingVariables( VariableSpace fromSpace, VariableSpace toSpace ); static void replaceVariableValues( VariableSpace childTransMeta, VariableSpace replaceBy );  }### Answer:
@SuppressWarnings( "unchecked" ) @Test @PrepareForTest( StepWithMappingMeta.class ) public void testExportResources() throws Exception { StepWithMappingMeta stepWithMappingMeta = spy( new StepWithMappingMeta() { @Override public void setDefault() { } @Override public StepDataInterface getStepData() { return null; } @Override public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans ) { return null; } } ); String testName = "test"; PowerMockito.mockStatic( StepWithMappingMeta.class ); when( StepWithMappingMeta.loadMappingMeta( any(), any(), any(), any() ) ).thenReturn( transMeta ); when( transMeta.exportResources( any(), anyMap(), any(), any(), any() ) ).thenReturn( testName ); stepWithMappingMeta.exportResources( null, null, null, null, null ); verify( transMeta ).setFilename( "${" + Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY + "}/" + testName ); verify( stepWithMappingMeta ).setSpecificationMethod( ObjectLocationSpecificationMethod.FILENAME ); }