ByteArrayOutputStream baScriptStream = new ByteArrayOutputStream();
ByteArrayOutputStream baTempletonArgsStream = new ByteArrayOutputStream();
FSDataOutputStream scriptStream = new FSDataOutputStream(baScriptStream);
FSDataOutputStream templetonArgsStream = new FSDataOutputStream(baTempletonArgsStream);
expect(hdfsApi.create(endsWith("script.pig"), eq(true))).andReturn(scriptStream);
expect(hdfsApi.create(endsWith("params"), eq(true))).andReturn(templetonArgsStream);
replay(hdfsApi);
JobService.setHdfsApi(hdfsApi);
TempletonApi api = createNiceMock(TempletonApi.class);