@Test public void test_getParent() throws Exception { assertThat(getParent(HTTP_URI), equalTo("/")); assertThat(getParent(create("http: assertThat(getParent(HTTP_WITH_PATH_URI), equalTo("/some/file")); assertThat(new File(getParent(FILE_ABS_URI)).getAbsolutePath(), equalTo(new File(File.separator + "home" + File.separator + "user").getAbsolutePath())); assertThat(new File(getParent(FILE_REL_URI)).getAbsolutePath(), equalTo(new File(PWD_PARENT).getAbsolutePath())); }
public static String getParent(final URI uri) { final String path = uri.getPath(); if (StringUtils.isBlank(path)) { return "/"; } final String parent = path.substring(0, path.lastIndexOf('/')).trim(); return StringUtils.isBlank(parent) ? "/" : parent; }
UriUtil { public static String getParent(final URI uri) { final String path = uri.getPath(); if (StringUtils.isBlank(path)) { return "/"; } final String parent = path.substring(0, path.lastIndexOf('/')).trim(); return StringUtils.isBlank(parent) ? "/" : parent; } }
UriUtil { public static String getParent(final URI uri) { final String path = uri.getPath(); if (StringUtils.isBlank(path)) { return "/"; } final String parent = path.substring(0, path.lastIndexOf('/')).trim(); return StringUtils.isBlank(parent) ? "/" : parent; } private  UriUtil(); }
UriUtil { public static String getParent(final URI uri) { final String path = uri.getPath(); if (StringUtils.isBlank(path)) { return "/"; } final String parent = path.substring(0, path.lastIndexOf('/')).trim(); return StringUtils.isBlank(parent) ? "/" : parent; } private  UriUtil(); static URI toUri(final String s); static boolean isFileUri(final URI uri); static Optional<String> getLastSegment(final URI uri); static String getLastSegmentOrHost(final URI uri); static String getParent(final URI uri); static String getPath(final URI uri); }
UriUtil { public static String getParent(final URI uri) { final String path = uri.getPath(); if (StringUtils.isBlank(path)) { return "/"; } final String parent = path.substring(0, path.lastIndexOf('/')).trim(); return StringUtils.isBlank(parent) ? "/" : parent; } private  UriUtil(); static URI toUri(final String s); static boolean isFileUri(final URI uri); static Optional<String> getLastSegment(final URI uri); static String getLastSegmentOrHost(final URI uri); static String getParent(final URI uri); static String getPath(final URI uri);  }