### Question:
ScriptExecutor { public static int execSafe(String file, String[] args) throws ExecuteException, IOException{ String actualScript = file; String[] args2 = args; if(file.contains(" ")){ String[] providedArguments = file.split("\\s+"); args2 = new String[providedArguments.length-1+args.length]; actualScript=providedArguments[0]; int i=1; for(i=1;i<providedArguments.length;i++){ args2[i-1]=providedArguments[i]; } for(int j=0;j<args.length;j++){ args2[j+i-1]=args[j]; } } return exec(actualScript, args2); }  static int exec(String file, String[] args); static int execSafe(String file, String[] args);  }### Answer:
@Test public void checkExecution() throws IOException, InvocationTargetException, IllegalAccessException { if(expectedExitCode!=0){ LOGGER.warn("Exception should be thrown in this test."); } int exitCode = ScriptExecutor.execSafe(cmd, args); assertEquals(expectedExitCode, exitCode); callbackMethod.invoke(this, callbackArgs); }