### Question:
GraphName { public GraphName getParent() { if (name.length() == 0) { return GraphName.empty(); } if (name.equals(GraphName.ROOT)) { return GraphName.root(); } int slashIdx = name.lastIndexOf('/'); if (slashIdx > 1) { return new GraphName(name.substring(0, slashIdx)); } if (isGlobal()) { return GraphName.root(); } return GraphName.empty(); } private  GraphName(String name); static GraphName newAnonymous(); static GraphName root(); static GraphName empty(); static GraphName of(String name); boolean isGlobal(); boolean isRoot(); boolean isEmpty(); boolean isPrivate(); boolean isRelative(); GraphName getParent(); GraphName getBasename(); GraphName toRelative(); GraphName toGlobal(); GraphName join(GraphName other); GraphName join(String other); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final String VALID_GRAPH_NAME_REGEXP; static final Pattern VALID_GRAPH_NAME_PATTERN; }### Answer:
@Test public void testGetParent() { GraphName global = GraphName.of("/"); GraphName empty = GraphName.of(""); assertEquals(empty, GraphName.of("").getParent()); assertEquals(global, GraphName.of("/").getParent()); assertEquals(GraphName.of("/wg"), GraphName.of("/wg/name").getParent()); assertEquals(GraphName.of("/wg"), GraphName.of("/wg/name/").getParent()); assertEquals(global, GraphName.of("/wg/").getParent()); assertEquals(global, GraphName.of("/wg").getParent()); assertEquals(GraphName.of("wg"), GraphName.of("wg/name").getParent()); assertEquals(empty, GraphName.of("wg/").getParent()); }