void () { String escaped = File.pathSeparator.equals(";") ? "\\;" : File.pathSeparator; List<String> list = substitute("PATH=/foo/bar" + escaped + "$PATH$", "PATH=/hey"); assertEquals("/foo/bar" + File.pathSeparator + "/hey", list.get(0)); }