FileUtil { public static String getSessionDirectoryName(String sessionId) { byte[] hash = HashUtil.hashSHA1(sessionId); return StringUtil.toHexString(hash, ""); }  static String getSessionDirectoryName(String sessionId); static File getSessionDirectory(String sessionId); static boolean makeSessionDirectory(String sessionId); static boolean removeSessionDirectory(String sessionId); static boolean rmdirs(File dir);  }
@Test public void testGetSessionDirectoryName01() throws Exception { String input = "01234567abcdefgh"; String result = FileUtil.getSessionDirectoryName(input); String hope = StringUtil.toHexString(HashUtil.hashSHA1(input), ""); assertEquals(hope, result); }
@Test public void testGetSessionDirectoryName02() throws Exception { String input = null; try { FileUtil.getSessionDirectoryName(input); fail(); } catch (NullPointerException e) { return; } }
@Test public void testGetSessionDirectoryName03() throws Exception { String input = ""; String result = FileUtil.getSessionDirectoryName(input); String hope = StringUtil.toHexString(HashUtil.hashSHA1(input), ""); assertEquals(hope, result); }