SupportedPaths { boolean mayContainCug(@NotNull String path) { if (supportedPaths.length == 0) { return false; } if (includesRootPath || PathUtils.denotesRoot(path)) { return true; } String path2 = path + '/'; for (String sp : supportedPaths) { if (sp.startsWith(path2)) { return true; } } return false; } SupportedPaths(@NotNull Set<String> supportedPaths);   }
@Test public void testMayContainCug() { SupportedPaths supportedPaths = new SupportedPaths(ImmutableSet.of("/content/a")); Map<String, Boolean> pathMap = new HashMap<>(); pathMap.put("/", true); pathMap.put("/content", true); pathMap.put("/jcr:system", false); pathMap.put("/testRoot", false); pathMap.put("/some/other/path", false); pathMap.put("/content/a", false); pathMap.put("/content/a/b", false); for (String path : pathMap.keySet()) { boolean expected = pathMap.get(path); assertEquals(path, expected, supportedPaths.mayContainCug(path)); } }