public List<String> toBatchTaskArgumentString() {
    List<String> res = new ArrayList<>(Arrays.asList(
        CLUSTER_LIMIT_FLAG, String.valueOf(mClusterLimit),
        CLUSTER_START_DELAY_FLAG, mClusterStartDelay,
        BENCH_TIMEOUT, mBenchTimeout,
        START_MS_FLAG, String.valueOf(mStartMs)));

    if (!mProfileAgent.isEmpty()) {
      res.add(PROFILE_AGENT);
      res.add(mProfileAgent);
    }

    if (!mId.equals(DEFAULT_TASK_ID)) {
      res.add(ID_FLAG);
      res.add(mId);
    }

    if (!mIndex.equals(DEFAULT_TASK_ID)) {
      res.add(INDEX_FLAG);
      res.add(mIndex);
    }

    if (!mJavaOpts.isEmpty()) {
      for (String s : mJavaOpts) {
        res.add(JAVA_OPT_FLAG);
        res.add(s);
      }
    }

    if (mCluster) {
      res.add(CLUSTER_FLAG);
    }
    if (mDistributed) {
      res.add(DISTRIBUTED_FLAG);
    }
    if (mInProcess) {
      res.add(IN_PROCESS_FLAG);
    }
    if (mHelp) {
      res.add(HELP_FLAG);
    }

    return res;
  }
@Test
  public void parseSingleParametersToArgument() throws Exception {
    // test single parameter
    List<String[]> inputArgs = Arrays.asList(
        new String[]{"--cluster-limit", "4"},
        new String[]{"--cluster-start-delay", "5s"},
        new String[]{"--profile-agent", "TestProfile"},
        new String[]{"--bench-timeout", "10m"},
        new String[]{"--id", "TestID"},
        new String[]{"--start-ms", "1000"},
        new String[]{"--distributed"},
        new String[]{"--in-process"},
        new String[]{"--help"}
    );

    for (String[] s : inputArgs) {
      mBaseParameter = new BaseParameters();
      JCommander jc = new JCommander(this);
      jc.parse(s);
      List<String> outputArgs = mBaseParameter.toBatchTaskArgumentString();
      if (s.length == 1) {
        assertTrue(outputArgs.contains(s[0]));
      }
      else {
        validateOutput(Arrays.asList(s), outputArgs, 1);
      }
    }
  }