enapps-enorman opened a new pull request, #19:
URL: https://github.com/apache/sling-org-apache-sling-testing-jcr-mock/pull/19

   The 
[javadocs](https://javadoc.io/static/javax.jcr/jcr/2.0/javax/jcr/Item.html#getAncestor(int))
 for "Item javax.jcr.Item.getAncestor(int depth)" describes the depth argument 
as:
   ```
   depth = 0 returns the root node of a workspace.
   depth = 1 returns the child of the root node along the path to this Item.
   depth = 2 returns the grandchild of the root node along the path to this 
Item.
   And so on to depth = n, where n is the depth of this Item, which returns 
this Item itself.
   ```
   
   However, the org.apache.sling.testing.mock.jcr.AbstractItem#getAncestor 
implementation is using "ResourceUtil.getParent(getPath(), depth)" which 
interprets the second argument as:
   ```
   level = 0 returns the path.
   level = 1 returns the parent of path, if it exists, null otherwise.
   level = 2 returns the grandparent of path, if it exists, null otherwise.
    ```
   
   Expected:
   AbstractItem#getAncestor should resolve the ancestor path as the item depth 
minus the supplied depth argument.
   ```
   this.session.getItem(ResourceUtil.getParent(getPath(), getDepth() - depth));
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to