### Question:
PathUtilities { static boolean isValid(String path) { Objects.requireNonNull(path, "Path can't be null"); if ("/".equals(path)) { return true; } if (path.startsWith("/")) { path = path.substring(1); } for (String part : split(path)) { if (!isPathNameValid(part)) { return false; } } return true; }    }### Answer:
@Test public void testPathsWithValidCharacters() { assertTrue(PathUtilities.isValid("level1")); assertTrue(PathUtilities.isValid("level-1")); assertTrue(PathUtilities.isValid("level-1/level-2/level3")); assertTrue(PathUtilities.isValid("1/2/a")); }
@Test public void testThatPathWithOnlyHyphenIsInvalid() { assertFalse(PathUtilities.isValid("level1/-/level3")); assertFalse(PathUtilities.isValid("-")); }
@Test public void testThatPathWithSpaceIsInvalid() { assertFalse(PathUtilities.isValid("level 1")); }
@Test public void testThatPathWithNoneAlphaNumericOrHyphenIsInvalid() { assertFalse(PathUtilities.isValid("apple_level")); assertFalse(PathUtilities.isValid("category%23/apple")); }
@Test public void testThatPathStartingWithSeparatorIsValid() { assertTrue(PathUtilities.isValid("/apple/ball")); }
@Test public void testRootPathIsValid() { assertTrue(PathUtilities.isValid("/")); }