OptionsAndArgs { public Pattern getProcessPattern() { String arg = extraArgs.size() > 0 ? extraArgs.get(0) : null; try { return arg != null && getPid() == null ? Pattern.compile(arg, Pattern.CASE_INSENSITIVE) : null; } catch (PatternSyntaxException exp) { throw new IllegalArgumentException("Invalid pattern '" + arg + "' for matching process names", exp); } } OptionsAndArgs(Set<String> pCommands, String ... pArgs); String toAgentArg(); String getPid(); Pattern getProcessPattern(); String getCommand(); List<String> getExtraArgs(); boolean isQuiet(); String getPort(); boolean isVerbose(); boolean needsVm(); String getJarFilePath(); String getJarFileName(); static File lookupJarFile();  }
@Test(expectedExceptions = IllegalArgumentException.class,expectedExceptionsMessageRegExp = ".*Invalid pattern.*") public void invalidPattern() { OptionsAndArgs o = opts("start", "i+*"); o.getProcessPattern(); }