### Question:
PythonShellParser { static List<String> parseYarn(String[] args) { String[] params = new String[args.length - 1]; System.arraycopy(args, 1, params, 0, params.length); CommandLine commandLine = parse(YARN_OPTIONS, params); if (commandLine.hasOption(OPTION_HELP.getOpt())) { printYarnHelp(); System.exit(0); } List<String> options = new ArrayList<>(); options.add(args[0]); options.add("-m"); options.add("yarn-cluster"); constructYarnOption(options, OPTION_CONTAINER, commandLine); constructYarnOption(options, OPTION_JM_MEMORY, commandLine); constructYarnOption(options, OPTION_NAME, commandLine); constructYarnOption(options, OPTION_QUEUE, commandLine); constructYarnOption(options, OPTION_SLOTS, commandLine); constructYarnOption(options, OPTION_TM_MEMORY, commandLine); return options; }  static void main(String[] args);  }### Answer:
@Test public void testParseYarnWithoutOptions() { String[] args = {"yarn"}; List<String> commandOptions = PythonShellParser.parseYarn(args); String[] expectedCommandOptions = {"yarn", "-m", "yarn-cluster"}; Assert.assertArrayEquals(expectedCommandOptions, commandOptions.toArray()); }
@Test public void testParseYarnWithOptions() { String[] args = {"yarn", "-n", "2", "-jm", "1024m", "-tm", "4096m"}; List<String> commandOptions = PythonShellParser.parseYarn(args); String[] expectedCommandOptions = {"yarn", "-m", "yarn-cluster", "-yn", "2", "-yjm", "1024m", "-ytm", "4096m"}; Assert.assertArrayEquals(expectedCommandOptions, commandOptions.toArray()); }