### Question:
TirePathTree { public String searchPathFilterRoles(String path) { if (path == null || "".equals(path) || !path.startsWith(URL_PATH_SPLIT)) { return null; } if (logger.isTraceEnabled()) { logger.trace("sureness - searchPathFilterRoles, path is {}", path); } path = PATH_SPLIT_PATTERN.matcher(path).replaceAll("/"); path = path.substring(1).toLowerCase(); String[] tmp = path.split("==="); if (tmp.length != PATH_NODE_NUM_2) { return null; } String[] urlPac = tmp[0].split("/"); String method = tmp[1]; Node current = root; return searchPathRoleInChildren(current, urlPac, -1, method); } TirePathTree(); synchronized void buildTree(Set<String> paths); synchronized void rebuildTree(Set<String> paths); void clearTree(); int getResourceNum(); String searchPathFilterRoles(String path);  }### Answer:
@Test public void searchPathFilterRoles() { buildTree(); Assert.assertEquals("[]", root.searchPathFilterRoles("/api/v2/book/node Assert.assertEquals("[role2]", root.searchPathFilterRoles("/api/v2/host===get")); Assert.assertEquals("[role1]", root.searchPathFilterRoles("/api/v2/host===post")); Assert.assertEquals("[role2,role3]", root.searchPathFilterRoles("/api/v2/host===delete")); Assert.assertEquals("[role3,role4]", root.searchPathFilterRoles("/api/v2/host===put")); Assert.assertEquals("[role2,role3,role4]", root.searchPathFilterRoles("/api/v1/host===put")); Assert.assertEquals("[role2,role3,role4]", root.searchPathFilterRoles("/api/v3/host===put")); Assert.assertEquals("[role2,role4]", root.searchPathFilterRoles("/api/v2/ha/host===put")); Assert.assertEquals("[role3,role4]", root.searchPathFilterRoles("/api/v4/mom/ha===put")); Assert.assertEquals("[role2,role4]", root.searchPathFilterRoles("/api/v6/mom/ha===put")); Assert.assertEquals("[role5]", root.searchPathFilterRoles("/api/mi/tom/hello===put")); Assert.assertEquals("[role6]", root.searchPathFilterRoles("/api/mo/tom/hello/day/day===get")); Assert.assertEquals("[role7]", root.searchPathFilterRoles("/api/day/day/day/day/book/day/mo===put")); Assert.assertEquals("[role5]", root.searchPathFilterRoles("/api/v5/day/book===put")); Assert.assertEquals("[role1]", root.searchPathFilterRoles("/api/demo/book/tom/egg===get")); Assert.assertEquals("[role2]", root.searchPathFilterRoles("/api/demo/book/tom/good/egg===get")); Assert.assertEquals("[role6]", root.searchPathFilterRoles("/api/v5/mom/ha===put")); Assert.assertEquals("[role9]", root.searchPathFilterRoles("/api/v5/mom/ha/good===get")); Assert.assertEquals("[role9]", root.searchPathFilterRoles("/api/v5/mom/ha===get")); Assert.assertEquals("[role10]", root.searchPathFilterRoles("/er/swagger===get")); Assert.assertNull(root.searchPathFilterRoles("/api/v6/book/ha/good===put")); Assert.assertEquals("[role11]", root.searchPathFilterRoles("/swagger===get")); }