### Question:
ScriptLanguageActionExecutor extends JavaActionExecutor { protected void addScriptToCache(Configuration conf, Element actionXml, Path appPath, Context context) throws ActionExecutorException { Namespace ns = actionXml.getNamespace(); String script = actionXml.getChild("script", ns).getTextTrim(); String name = new Path(script).getName(); String scriptContent = context.getProtoActionConf().get(this.getScriptName()); Path scriptFile = null; if (scriptContent != null) { FSDataOutputStream dos = null; try { Path actionPath = context.getActionDir(); scriptFile = new Path(actionPath, script); FileSystem fs = context.getAppFileSystem(); dos = fs.create(scriptFile); dos.write(scriptContent.getBytes(StandardCharsets.UTF_8)); addToCache(conf, actionPath, script + "#" + name, false); } catch (Exception ex) { throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "FAILED_OPERATION", XLog .format("Not able to write script file {0} on hdfs", scriptFile), ex); } finally { try { if (dos != null) { dos.close(); } } catch (IOException ex) { XLog.getLog(getClass()).error("Error: " + ex.getMessage()); } } } else { addToCache(conf, appPath, script + "#" + name, false); } } ScriptLanguageActionExecutor(String type); @Override List<Class<?>> getLauncherClasses();  }### Answer:
@Test public void multibyteInputsAreAcceptedInScripts() throws Exception { final String testInput = "林檎"; doReturn(mockScript).when(mockElement).getChild(anyString(), any()); doReturn("script").when(mockScript).getTextTrim(); doReturn(mockActionConfig).when(mockContext).getProtoActionConf(); doReturn(testInput).when(mockActionConfig).get(isNull()); doReturn(new Path(".")).when(mockContext).getActionDir(); doReturn(mockFs).when(mockContext).getAppFileSystem(); doReturn(fsDataOutputStream).when(mockFs).create(any()); ScriptLanguageActionExecutor scriptLanguageActionExecutor = spy(new ScriptLanguageActionExecutor("pig") { @Override protected String getScriptName() { return null; } }); scriptLanguageActionExecutor.addScriptToCache(mockConfiguration, mockElement, mockPath, mockContext); byte[] expectedInput = testInput.getBytes(StandardCharsets.UTF_8); verify(fsDataOutputStream).write(expectedInput); }