### Question:
Args { public static Args parseArgs(String... cliArgs) { Args args = new Args(); if (Objects.equals(MINUS_VERSION, cliArgs[0])) { args.version = true; return args; } if (Objects.equals(MINUS_HELP, cliArgs[0])) { args.help = true; return args; } int idx = 0; int tries = 0; while (true) { String tmp = cliArgs[idx]; if (Objects.equals(MINUS_CP, tmp)) { break; } if (Objects.equals(MINUS_JAR, tmp)) { break; } if (tries > 200) { System.out.println("parse args in loop. check input args."); throw new IllegalArgumentException(); } if (Objects.equals(MINUS_VERBOSE, cliArgs[idx])) { idx++; args.verbose = true; } if (Objects.equals(MINUS_VERBOSE_TRACE, cliArgs[idx])) { idx++; args.verboseTrace = true; } if (Objects.equals(MINUS_VERBOSE_CALL, cliArgs[idx])) { idx++; args.verboseCall = true; } if (Objects.equals(MINUS_VERBOSE_CLASS, cliArgs[idx])) { idx++; args.verboseClass = true; } if (Objects.equals(MINUS_VERBOSE_DEBUG, cliArgs[idx])) { idx++; args.verboseDebug = true; } if (Objects.equals(MINUS_COLOR_RED, cliArgs[idx])) { idx++; Logger.fg = Logger.ANSI_RED; } if (Objects.equals(MINUS_COLOR_GREEN, cliArgs[idx])) { idx++; Logger.fg = Logger.ANSI_GREEN; } if (Objects.equals(MINUS_COLOR_YELLOW, cliArgs[idx])) { idx++; Logger.fg = Logger.ANSI_YELLOW; } tries++; } if (MINUS_CP.equals(cliArgs[idx])) { idx++; args.classpath = cliArgs[idx++]; } if (MINUS_JAR.equals(cliArgs[idx])) { idx++; String mainJar = cliArgs[idx++]; args.classpath = args.classpath + ":" + mainJar; args.clazz = parseMainClass(mainJar); } else { args.clazz = cliArgs[idx++]; } if (cliArgs.length > idx) { String[] programArgs = new String[cliArgs.length - idx]; System.arraycopy(cliArgs, idx, programArgs, 0, programArgs.length); args.args = programArgs; } return args; }  static Args parseArgs(String... cliArgs); public String classpath; public String clazz; public String[] args; }### Answer:
@Test public void test_normal() { Args args = Args.parseArgs("-cp", "target/test.jar", "Main", "help"); assertTrue(!args.version); assertEquals("target/test.jar", args.classpath); assertEquals("Main", args.clazz); assertEquals(1, args.args.length); assertEquals("help", args.args[0]); }
@Test public void test_without_program_args() { Args args = Args.parseArgs("-cp", "target/test.jar", "Main"); assertTrue(!args.version); assertEquals("target/test.jar", args.classpath); assertEquals("Main", args.clazz); assertEquals(0, args.args.length); }
@Test public void test_help() { Args args = Args.parseArgs("-help"); assertTrue(args.help); }
@Test public void test_verbose_cp() { Args args = Args.parseArgs("-verbose", "-cp", "example", "Main"); assertTrue(args.verbose); assertEquals("example", args.classpath); assertEquals("Main", args.clazz); }
@Test public void test_verbose_cp2() { Args args = Args.parseArgs("-cp", "example", "-verbose", "Main"); assertTrue(!args.verbose); }
@Test public void test_version() { Args args = Args.parseArgs("-version"); assertTrue(args.version); }