### Question:
MultiSparkExecArguments implements Serializable { public static String[] createCommandLine(List<SparkApplicationCommand> specs) { try { String json = APP_CMD_WRITER.writeValueAsString(specs); String escaped = json.replaceAll("\\\\n", "\\\\\\\\n"); String[] args = new String[] { APPS_SWITCH, "'" + escaped + "'" }; log.debug("MultiSparkExeApp args: {} {}", args[0], args[1]); return args; } catch (JsonProcessingException e) { throw new IllegalArgumentException("Unable to serialize Spark application commands", e); } } MultiSparkExecArguments(String... args); static String[] createCommandLine(List<SparkApplicationCommand> specs); List<SparkApplicationCommand> getCommands(); static final String APPS_SWITCH; }### Answer:
@Test public void testCreateCommandLine() { List<SparkApplicationCommand> commands = new SparkApplicationCommandsBuilder() .application("merge") .className("com.thinkbiganalytics.spark.mergetable.TableMergeApp") .addArgument("partition-keys", "\"registration_dttm_month|int|month(registration_dttm) registration_dttm_year|int|year(registration_dttm)\"") .addArgument("column-specs", "\"registration_dttm|timestamp||0|1|0|registration_dttm id|int||1|0|0|id first_name|string||0|0|0|first_name last_name|string||0|0|0|last_name email|string||0|0|0|email gender|string||0|0|0|gender\"") .addArgument("source-table", "spark_merge.user_ingest_sparksync_valid") .addArgument("target-table", "spark_merge.user_ingest_sparksync") .addArgument("partition-value", "1523397222536") .addArgument("merge-strategy", "DEDUPE_AND_MERGE") .add() .build(); String[] commandLine = MultiSparkExecArguments.createCommandLine(commands); assertThat(commandLine).isNotEmpty(); }