AdbPathUtil { @NotNull public static String getParentPath(@NotNull String path) { if (StringUtil.isEmpty(path)) { return ""; } int end = path.lastIndexOf(FILE_SEPARATOR); if (end == path.length() - 1) { end = path.lastIndexOf(FILE_SEPARATOR, end - 1); } switch(end) { case -1: return ""; case 0: return FILE_SEPARATOR; default: return path.substring(0, end); } }  @NotNull static String getFileName(@NotNull String path); @NotNull static String getParentPath(@NotNull String path); @NotNull static String resolve(@NotNull String basePath, @NotNull String other); @NotNull static String getEscapedPath(@NotNull String path); @NotNull static List<String> getSegments(@NotNull String path); @NotNull
  static final String FILE_SEPARATOR; @NotNull
  static final String DEVICE_TEMP_DIRECTORY; }
@Test public void testGetParentPath() { assertThat(AdbPathUtil.getParentPath("")).isEqualTo(""); assertThat(AdbPathUtil.getParentPath("/")).isEqualTo(""); assertThat(AdbPathUtil.getParentPath("/foo")).isEqualTo("/"); assertThat(AdbPathUtil.getParentPath("/foo/")).isEqualTo("/"); assertThat(AdbPathUtil.getParentPath("/foo/bar")).isEqualTo("/foo"); assertThat(AdbPathUtil.getParentPath("/foo/bar/")).isEqualTo("/foo"); assertThat(AdbPathUtil.getParentPath("/foo/blah/bar-test.txt")).isEqualTo("/foo/blah"); }