Exemplo n.º 1
0
        public void TestRemoveFromParent()
        {
            BooleanQueryNode booleanNode = new BooleanQueryNode(Collections.EmptyList <IQueryNode>());
            FieldQueryNode   fieldNode   = new FieldQueryNode("foo", "A", 0, 1);

            assertNull(fieldNode.Parent);

            booleanNode.Add(fieldNode);
            assertNotNull(fieldNode.Parent);

            fieldNode.RemoveFromParent();
            assertNull(fieldNode.Parent);

            booleanNode.Add(fieldNode);
            assertNotNull(fieldNode.Parent);

            booleanNode.Set(Collections.EmptyList <IQueryNode>());
            assertNull(fieldNode.Parent);
        }
Exemplo n.º 2
0
        public void TestRemoveFromParent()
        {
            BooleanQueryNode booleanNode = new BooleanQueryNode(Collections.EmptyList <IQueryNode>());
            FieldQueryNode   fieldNode   = new FieldQueryNode("foo", "A", 0, 1);

            assertNull(fieldNode.Parent);

            booleanNode.Add(fieldNode);
            assertNotNull(fieldNode.Parent);

            fieldNode.RemoveFromParent();
            assertNull(fieldNode.Parent);
            /* LUCENE-5805 - QueryNodeImpl.removeFromParent does a lot of work without any effect */
            assertFalse(booleanNode.GetChildren().Contains(fieldNode));

            booleanNode.Add(fieldNode);
            assertNotNull(fieldNode.Parent);

            booleanNode.Set(Collections.EmptyList <IQueryNode>());
            assertNull(fieldNode.Parent);
        }