@Test
public void createScriptFileWithEnvVariablesTest() {

  String expectedFile = "file";
  String variable = "FileVariable";
  Variables variables = new Variables();
  variables.setVariable( variable, expectedFile );
  //Init the variables in the step
  setInternalState( teraDataBulkLoaderMock, "variables", variables );
  //Return the variable instead of the filename, in the end the script should contain filename and not the variable name.
  when( teraDataBulkLoaderMetaMock.getExistingScriptFile() ).thenReturn( "${" + variable + "}" );
  when( teraDataBulkLoaderMock.environmentSubstitute( anyString() ) ).thenCallRealMethod();
  File file = new File( expectedFile );
  try {
    //Need to exist to simulate the test
    file.createNewFile();
    file.deleteOnExit();
    String script = teraDataBulkLoaderRoutines.createScriptFile();
    assertTrue( script.contains( expectedFile ) );
  } catch ( Exception ex ) {
    fail( ex.getMessage() );
  } finally {
    file.delete();
  }
}