### Question:
RegexUtil { static String getPackagePath(String className) { if (className == null) { return ""; } Matcher matcher = DOT.matcher(className); if (matcher.find()) { String path = matcher.replaceAll("\\/"); return path.substring(0, path.lastIndexOf("/")); } else { return ""; } } private  RegexUtil();   }### Answer:
@Test public void testGetPackagePath() { assertTrue(RegexUtil.DOT.matcher(".").find()); assertTrue(RegexUtil.DOT.matcher("abc.aa.aa").find()); assertEquals("", RegexUtil.getPackagePath(null)); assertEquals("", RegexUtil.getPackagePath("")); assertEquals("", RegexUtil.getPackagePath("b")); assertEquals("a", RegexUtil.getPackagePath("a.b")); assertEquals("a/c", RegexUtil.getPackagePath("a.c.b")); }