Uploaded image for project: '[Read Only] - Hippo Repository'
  1. [Read Only] - Hippo Repository
  2. REPO-1549

MockNode#hasNodes does not work correctly

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • High
    • Resolution: Fixed
    • 2.26.21, 3.2.4, 4.0.1, 4.1.0
    • 4.1.0
    • None
    • None
    • 0.5
    • Platform Sprint 137

    Description

      Please run the following unit-test.

      import javax.jcr.Node;
      import javax.jcr.RepositoryException;
      
      import org.junit.Test;
      import org.onehippo.repository.mock.MockNode;
      
      import static org.hamcrest.Matchers.is;
      import static org.junit.Assert.assertThat;
      
      public class TestMockNode {
      
          @Test
          public void testHasNode() throws RepositoryException {
              final MockNode root = MockNode.root();
              final Node fooNode = root.addNode("foo", "hst:virtualhost");
              
              assertThat(root.hasNode("foo"), is(true));
              assertThat(root.hasNodes(), is(true));
      
              fooNode.remove();
      
              assertThat(root.getNodes().hasNext(), is(false));
              assertThat(root.hasNodes(), is(false));
          }
      }
      

      After the child node 'foo' is removed, root.hasNode() should return false. However it still returns true.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cngo Canh Ngo (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: