ProcessWrapper implements Runnable { public ProcessWrapper setCommand(Path _executable, String... _args) throws ProcessWrapperException { for (int i = 0; i < _args.length; i++) { final Matcher m = ALLOWED.matcher(_args[i]); if (!m.matches() && !FileUtil.isAccessibleFile(_args[i]) && !FileUtil.isAccessibleDirectory(_args[i])) throw new ProcessWrapperException( "Illegal characters in argument [" + i + "], allowed are: a-zA-Z_0-9-.="); } this.exe = _executable; this.args = _args; return this; } ProcessWrapper();  ProcessWrapper(String _id); String getId(); ProcessWrapper setCommand(Path _executable, String... _args); ProcessWrapper setPath(Path _p); @Override void run(); Path getOutFile(); Path getErrFile(); int getExitCode(); boolean terminatedWithSuccess(); String getCommand();  }
@Test(expected = org.eclipse.steady.python.ProcessWrapperException.class) public void testIllegalChar() throws ProcessWrapperException { ProcessWrapper pw = new ProcessWrapper(); pw.setCommand(Paths.get("pip"), "foo", "---..--", "\\asas"); }
@Test public void testLegalChar() throws ProcessWrapperException { ProcessWrapper pw = new ProcessWrapper(); pw.setCommand(Paths.get("pip"), "bar", "---..--"); }