### Question:
PathUtils { public static boolean checkPath(String path, Predicate<String> segmentChecker) { for (String fragment : path.split("/")) { if (fragment.isEmpty() || isVariable(fragment)) { continue; } if (!segmentChecker.test(fragment)) { return false; } } return true; } private  PathUtils(); static boolean isVariable(String fragment); static boolean checkPath(String path, Predicate<String> segmentChecker); static boolean isSpinalCase(String fragment); static boolean isResourcePath(String path); static String terminalSegment(String path); static String trimTrailingSlash(String path); static final Pattern SPINAL_CASE_PATTERN; }### Answer:
@Test public void detects_nonspinal() { assertTrue(checkPath("/some/naive/path", PathUtils::isSpinalCase)); assertTrue(checkPath("/some/naive/path-with-dashes", PathUtils::isSpinalCase)); assertTrue(checkPath("/multi-spinal/path-example", PathUtils::isSpinalCase)); assertTrue(checkPath("/multi-spinal/path-example/with-0123", PathUtils::isSpinalCase)); assertFalse(checkPath("/Some/naive/Path", PathUtils::isSpinalCase)); assertFalse(checkPath("/some_other/path", PathUtils::isSpinalCase)); assertFalse(checkPath("/yetAnother/path", PathUtils::isSpinalCase)); assertFalse(checkPath("/some/1234/weirdPath", PathUtils::isSpinalCase)); }
@Test public void ignores_path_variables() { assertTrue(checkPath("/pets/{someVariable}", PathUtils::isSpinalCase)); }