### Question:
PathUtils { public static String terminalSegment(String path) { path = trimTrailingSlash(path); String[] split = path.split("/"); return split[split.length - 1]; } 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 extracts_terminal_segments() { assertThat(terminalSegment("/")).isEqualTo(""); assertThat(terminalSegment("/something")).isEqualTo("something"); assertThat(terminalSegment("/something/")).isEqualTo("something"); assertThat(terminalSegment("/something/else")).isEqualTo("else"); }