### Question:
LauncherAMUtils { public static String[] getMainArguments(Configuration conf) { String[] args = new String[conf.getInt(CONF_OOZIE_ACTION_MAIN_ARG_COUNT, 0)]; String[] retArray; if (conf.getBoolean(CONF_OOZIE_NULL_ARGS_ALLOWED, true)) { for (int i = 0; i < args.length; i++) { args[i] = conf.get(CONF_OOZIE_ACTION_MAIN_ARG_PREFIX + i); } retArray = args; } else { int pos = 0; for (int i = 0; i < args.length; i++) { String arg = conf.get(CONF_OOZIE_ACTION_MAIN_ARG_PREFIX + i); if (!Strings.isNullOrEmpty(arg)) { args[pos++] = conf.get(CONF_OOZIE_ACTION_MAIN_ARG_PREFIX + i); } } retArray = new String[pos]; System.arraycopy(args, 0, retArray, 0, pos); } return retArray; }  static String getLocalFileContentStr(File file, String type, int maxLen); static String[] getMainArguments(Configuration conf); static final String CONF_OOZIE_ACTION_MAX_OUTPUT_DATA; static final String HADOOP2_WORKAROUND_DISTRIBUTED_CACHE; static final String PROPAGATION_CONF_XML; static final String ROOT_LOGGER_LEVEL; }### Answer:
@Test public void testArgsHandlingWithoutNullsAndNullsNotAllowed() { setupConf(Arrays.asList("a", "b", "c")); setEnableNullArgsAllowed(false); String args[] = LauncherAMUtils.getMainArguments(conf); assertTrue(Arrays.equals(new String[] { "a", "b", "c"}, args)); }
@Test public void testHandlingWhenArgsContainNullsAndNullsNotAllowed() { setupConf(Arrays.asList("a", null, "b", null, "c")); setEnableNullArgsAllowed(false); String args[] = LauncherAMUtils.getMainArguments(conf); assertTrue(Arrays.equals(new String[] { "a", "b", "c"}, args)); }
@Test public void testArgsHandlingWhenArgsContainsNullsOnlyAndNullsNotAllowed() { setupConf(Arrays.asList(null, null, null)); setEnableNullArgsAllowed(false); String args[] = LauncherAMUtils.getMainArguments(conf); assertTrue(Arrays.equals(new String[] {}, args)); }
@Test public void testArgsHandlingWhenArgsContainsOneNullAndNullsNotAllowed() { setupConf(Arrays.asList((String) null)); setEnableNullArgsAllowed(false); String args[] = LauncherAMUtils.getMainArguments(conf); assertTrue(Arrays.equals(new String[] {}, args)); }
@Test public void testHandlingWhenArgsContainNullsAndNullAllowed() { setupConf(Arrays.asList("a", null, "b", null, "c")); setEnableNullArgsAllowed(true); String args[] = LauncherAMUtils.getMainArguments(conf); assertTrue(Arrays.equals(new String[] { "a", null, "b", null, "c"}, args)); }
@Test public void testArgsHandlingWhenArgsContainsOneNullAndNullsAllowed() { setupConf(Arrays.asList((String) null)); setEnableNullArgsAllowed(true); String args[] = LauncherAMUtils.getMainArguments(conf); assertTrue(Arrays.equals(new String[] { null }, args)); }