AbstractJcrItem implements Item, Namespaced { @Override public abstract AbstractJcrNode getParent() throws ItemNotFoundException, RepositoryException; protected  AbstractJcrItem( JcrSession session ); @Override Item getAncestor( int depth ); @Override int getDepth(); @Override abstract AbstractJcrNode getParent();  }
@Test public void parentOfPropertyShouldBeNode() throws Exception { assertThat(newPropertyOnModifiedNode.getParent(), is(nodeWithModifiedProperty)); assertThat(modifiedPropertyOnModifiedNode.getParent(), is(nodeWithModifiedProperty)); assertThat(unmodifiedPropertyOnModifiedNode.getParent(), is(nodeWithModifiedProperty)); }
@Test public void parentOfNodeShouldBeParentNode() throws Exception { assertThat(savedNode.getParent(), is(rootNode)); assertThat(newNode.getParent(), is(rootNode)); assertThat(nodeWithModifiedProperty.getParent(), is(rootNode)); assertThat(nodeWithModifiedChildren.getParent(), is(rootNode)); assertThat(nodeOfDepth2.getParent(), is(nodeWithModifiedChildren)); }
@Test( expected = ItemNotFoundException.class ) public void parentOfRootNodeShouldFail() throws Exception { rootNode.getParent(); }