ZkUtils { static String namespace(String path) { if (isNullOrEmpty(path)) { return null; } while (!path.isEmpty() && path.charAt(0) == PATH_SEP) { path = path.substring(1); } while (!path.isEmpty() && path.charAt(path.length() - 1) == PATH_SEP) { path = path.substring(0, path.length() - 1); } return path.isEmpty() ? null : path; } private  ZkUtils();   }
@Test public void testNamespace() throws Exception { assertEquals(namespace("/name/space/"), "name/space"); assertEquals(namespace("/name/space"), "name/space"); assertEquals(namespace("namespace"), "namespace"); assertEquals(namespace(" }