### Question:
CommandFlags { public boolean parse() throws ArgumentParseException { boolean anyFlags = false; int oldIndex = args.index; args.index = args.length() + 1; for (Iterator<String> it = args.getLive().iterator(); it.hasNext(); ) { if (tryExtractFlags(it)) { anyFlags = true; } } args.index = oldIndex; return anyFlags; } CommandFlags(CommandArguments args); void registerFlags(Flag... flags); void registerFlags(List<Flag> flags); boolean parse(); boolean hasFlag(String flag); static final Pattern FLAG_REGEX; }### Answer:
@Test public void testUndefinedFlags() throws ArgumentParseException { CommandArguments args = new CommandArguments("flag", "--source=risaccess1", "--target=waylon531"); CommandFlags flags = args.flags(); flags.parse(); assertEquals("risaccess1", args.popString("source")); assertEquals("waylon531", args.popString("target")); }