FileUtils { public static String shortPath(String absolutePath) { return shortPath(absolutePath, DEFAULT_SHORT_PATH_LEVEL); }  static void recursiveDelete(File file); static String shortPath(String absolutePath); static String shortPath(String absolutePath, int level); static InputStream getFileInputStream(String fileName); static InputStream getFileInputStream(String path, String fileName); static InputStream getFileInputStream(String fileName, Class<?> clazz); static InputStream getFileInputStream(String path, String fileName, Class<?> clazz); static String readFileAsString(String fileName); static int DEFAULT_SHORT_PATH_LEVEL; }
@Test public void testShortPath(){ Assert.assertEquals("#a#b#c", FileUtils.shortPath("#a#b#c", 2)); Assert.assertEquals("/d/e", FileUtils.shortPath("/a/b/c/d/e", 2)); Assert.assertEquals("/a/b/c/d/e", FileUtils.shortPath("/a/b/c/d/e", 5)); Assert.assertEquals("/a/b/c/d/e", FileUtils.shortPath("/a/b/c/d/e", 6)); }