Util { public static File toFile(File baseDir, String path) { File result = baseDir; for (String part : path.split("/")) { result = new File(result, part); } return result; } private  Util(); static String toRealPagePath(String pagePath); static String toUrlPagePath(String pagePath); static String simplifyForUrl(String text); static String join(Object o, String delimiter); static void deleteQuietly(File f); static RuntimeException toRuntimeException(Throwable t); static File toFile(File baseDir, String path); static void closeQuietly(Closeable c); static Map<String, String> parseParameters(String params); static String serialize(Serializable s); static T deserialize(String s, Class<T> clazz);  }
@Test public void toFile() { File dir = new File("."); File result = Util.toFile(dir, "x/y/z"); File expectedFile = new File(new File(new File(dir, "x"), "y"), "z"); assertEquals(expectedFile, result); }