PathPrefixUtil { public static String strip(HibBranch branch, String path) { String prefix = branch.getPathPrefix(); prefix = sanitize(prefix); return !startsWithPrefix(branch, path) ? path : path.substring(prefix.length()); } private  PathPrefixUtil(); static String sanitize(String prefix); static String strip(HibBranch branch, String path); static boolean startsWithPrefix(HibBranch branch, String path);  }
@Test public void testStrip() { Branch branch = Mockito.mock(Branch.class); when(branch.getPathPrefix()).thenReturn(""); assertEquals("", PathPrefixUtil.strip(branch, "")); when(branch.getPathPrefix()).thenReturn("abc"); assertEquals("", PathPrefixUtil.strip(branch, "")); assertEquals("", PathPrefixUtil.strip(branch, "/abc")); }