SystemUtil { static List<String> prepareProcessArguments(String exec, String params) { List<String> cmdList; if (new File(exec).exists()) { cmdList = new ArrayList<>(Collections.singletonList(exec)); } else { cmdList = new ArrayList<>(splitIntoProcessArguments(exec)); } cmdList.addAll(splitIntoProcessArguments(params)); return cmdList; }  @Deprecated static long getSystemTimeMillis(); static long getTimeBasedSeed(); static int getTimeBasedIntSeed(); static long getRelativeTimeMillis(); static long getFreeMemory(); static String getPropertyOrEnvironmentVariable(String name); static boolean runProcessAndWait(String exec, String params); static boolean runProcessAndWait(String exec, String params, String workingDirPath); static int runProcessAndGetExitCode(String exec, String params); static int runProcessAndGetExitCode(String exec, String params, String workingDirPath); static String runProcessAndGetOutput(String command, String params); static StringBuilder runProcessAndCollectErrors(String execPath, String params);  }
@Test public void prepareProcessArgumentsStubExecFileTest() { List<String> processArguments = SystemUtil.prepareProcessArguments(STUB_EXEC_FILE, "param1 param2"); Assert.assertEquals(Arrays.asList( "./src/test/resources/com/itextpdf/io/util/SystemUtilTest/folder with space/stubFile", "param1", "param2"), processArguments); }
@Test public void prepareProcessArgumentsStubExecFileInQuotesTest() { String testLine = "\"" + STUB_EXEC_FILE + "\"" + " compare"; List<String> processArguments = SystemUtil.prepareProcessArguments(testLine, "param1 param2"); Assert.assertEquals(Arrays.asList( "./src/test/resources/com/itextpdf/io/util/SystemUtilTest/folder with space/stubFile", "compare", "param1", "param2"), processArguments); }
@Test public void prepareProcessArgumentsGsTest() { List<String> processArguments = SystemUtil.prepareProcessArguments("gs", "param1 param2"); Assert.assertEquals(Arrays.asList( "gs", "param1", "param2"), processArguments); }
@Test public void prepareProcessArgumentsMagickCompareTest() { List<String> processArguments = SystemUtil.prepareProcessArguments("magick compare", "param1 param2"); Assert.assertEquals(Arrays.asList( "magick", "compare", "param1", "param2"), processArguments); }