@Test(dataProvider = "getFixedWindowsPathProvider") public void getFixedWindowsPathTest(String path, String expected) { String actual = CommandExecutor.getFixedWindowsPath(path); assertEquals(actual, expected); }
static String getFixedWindowsPath(String path) { String[] pathParts = path.split(";"); String[] newPathParts = new String[pathParts.length]; for (int index = 0; index < pathParts.length; index++) { String part = pathParts[index]; int backSlashIndex = part.indexOf('\\'); if (backSlashIndex < 0) { newPathParts[index] = part.replaceAll(":", ";"); continue; } String startPart = part.substring(0, backSlashIndex); String endPart = part.substring(backSlashIndex); String newPart = startPart + endPart.replaceAll(":", ";"); newPathParts[index] = newPart; } return String.join(";", newPathParts); }
CommandExecutor implements Serializable { static String getFixedWindowsPath(String path) { String[] pathParts = path.split(";"); String[] newPathParts = new String[pathParts.length]; for (int index = 0; index < pathParts.length; index++) { String part = pathParts[index]; int backSlashIndex = part.indexOf('\\'); if (backSlashIndex < 0) { newPathParts[index] = part.replaceAll(":", ";"); continue; } String startPart = part.substring(0, backSlashIndex); String endPart = part.substring(backSlashIndex); String newPart = startPart + endPart.replaceAll(":", ";"); newPathParts[index] = newPart; } return String.join(";", newPathParts); } }
CommandExecutor implements Serializable { static String getFixedWindowsPath(String path) { String[] pathParts = path.split(";"); String[] newPathParts = new String[pathParts.length]; for (int index = 0; index < pathParts.length; index++) { String part = pathParts[index]; int backSlashIndex = part.indexOf('\\'); if (backSlashIndex < 0) { newPathParts[index] = part.replaceAll(":", ";"); continue; } String startPart = part.substring(0, backSlashIndex); String endPart = part.substring(backSlashIndex); String newPart = startPart + endPart.replaceAll(":", ";"); newPathParts[index] = newPart; } return String.join(";", newPathParts); } CommandExecutor(String executablePath, Map<String, String> env); }
CommandExecutor implements Serializable { static String getFixedWindowsPath(String path) { String[] pathParts = path.split(";"); String[] newPathParts = new String[pathParts.length]; for (int index = 0; index < pathParts.length; index++) { String part = pathParts[index]; int backSlashIndex = part.indexOf('\\'); if (backSlashIndex < 0) { newPathParts[index] = part.replaceAll(":", ";"); continue; } String startPart = part.substring(0, backSlashIndex); String endPart = part.substring(backSlashIndex); String newPart = startPart + endPart.replaceAll(":", ";"); newPathParts[index] = newPart; } return String.join(";", newPathParts); } CommandExecutor(String executablePath, Map<String, String> env); CommandResults exeCommand(File execDir, List<String> args, Log logger); }
CommandExecutor implements Serializable { static String getFixedWindowsPath(String path) { String[] pathParts = path.split(";"); String[] newPathParts = new String[pathParts.length]; for (int index = 0; index < pathParts.length; index++) { String part = pathParts[index]; int backSlashIndex = part.indexOf('\\'); if (backSlashIndex < 0) { newPathParts[index] = part.replaceAll(":", ";"); continue; } String startPart = part.substring(0, backSlashIndex); String endPart = part.substring(backSlashIndex); String newPart = startPart + endPart.replaceAll(":", ";"); newPathParts[index] = newPart; } return String.join(";", newPathParts); } CommandExecutor(String executablePath, Map<String, String> env); CommandResults exeCommand(File execDir, List<String> args, Log logger);  }