InMemoryPath implements Path { @Override public Path getParent() { final List<String> normalizedPath = normalizeModel(pathElements); if(normalizedPath.isEmpty()) { return null; } else { final List<String> subPath = normalizedPath.subList(0, normalizedPath.size() - 1); return new InMemoryPath(subPath); } } private  InMemoryPath(final List<String> pathElements);  InMemoryPath(final String relativePath); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); @Override Path getParent(); @Override Path normalize(); @Override Path resolve(Path other); @Override Path resolve(String other); @Override Path getFileName(); @Override URI toUri(); @Override Path relativize(Path other); @Override Path resolveSibling(Path other); @Override Path resolveSibling(String other); @Override Iterator<Path> iterator(); @Override Path getName(int index); @Override FileSystem getFileSystem(); @Override Path toAbsolutePath(); @Override Path toRealPath(LinkOption... options); @Override File toFile(); @Override WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers); @Override WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events); @Override int compareTo(Path other); @Override boolean isAbsolute(); @Override Path getRoot(); @Override int getNameCount(); @Override Path subpath(int beginIndex, int endIndex); @Override boolean startsWith(Path other); @Override boolean startsWith(String other); @Override boolean endsWith(Path other); @Override boolean endsWith(String other);  }
@Test public void testGetParent() { final InMemoryPath path = new InMemoryPath("less/hpe-elements/main.less"); assertEquals(new InMemoryPath("less/hpe-elements"), path.getParent()); }
@Test public void testGetParentWhenPathEmpty() { final InMemoryPath path = new InMemoryPath(""); assertNull(path.getParent()); }