PathPrefixUtil { public static boolean startsWithPrefix(HibBranch branch, String path) { String prefix = branch.getPathPrefix(); prefix = sanitize(prefix); return path.startsWith(prefix); } private  PathPrefixUtil(); static String sanitize(String prefix); static String strip(HibBranch branch, String path); static boolean startsWithPrefix(HibBranch branch, String path);  }
@Test public void testStartsWithPrefix() { Branch branch = Mockito.mock(Branch.class); when(branch.getPathPrefix()).thenReturn("cba"); assertFalse(PathPrefixUtil.startsWithPrefix(branch, "/abc")); when(branch.getPathPrefix()).thenReturn("abc"); assertTrue(PathPrefixUtil.startsWithPrefix(branch, "/abc")); }