EscapeUtil { public static String combineToPath(List<String> pParts) { if (pParts != null && pParts.size() > 0) { StringBuilder buf = new StringBuilder(); Iterator<String> it = pParts.iterator(); while (it.hasNext()) { String part = it.next(); buf.append(escapePart(part != null ? part : "*")); if (it.hasNext()) { buf.append("/"); } } return buf.toString(); } else { return null; } } private  EscapeUtil(); static String combineToPath(List<String> pParts); static List<String> parsePath(String pPath); static Stack<String> extractElementsFromPath(String pPath); static Stack<String> reversePath(List<String> pathParts); static List<String> split(String pArg, String pEscape, String pDelimiter); static String[] splitAsArray(String pArg, String pEscape, String pDelimiter); static String escape(String pArg, String pEscape, String pDelimiter); static final String PATH_ESCAPE; static final String CSV_ESCAPE; }
@Test public void pathCombining() { for (int i = 0; i< PATH_SPLIT_TEST_DATA.length; i += 3) { if ((Boolean) PATH_SPLIT_TEST_DATA[i+2]) { String glued = EscapeUtil.combineToPath((List<String>) PATH_SPLIT_TEST_DATA[i + 1]); assertEquals(glued,PATH_SPLIT_TEST_DATA[i]); } } }