org.apache.commons.configuration.tree.xpath
Class TestXPathExpressionEngine

java.lang.Object
  extended by org.apache.commons.configuration.tree.xpath.TestXPathExpressionEngine

public class TestXPathExpressionEngine
extends Object

Test class for XPathExpressionEngine.

Version:
$Id: TestXPathExpressionEngine.java 1226111 2011-12-31 15:44:50Z oheger $
Author:
Commons Configuration team

Constructor Summary
TestXPathExpressionEngine()
           
 
Method Summary
protected  void checkSelectCalls(int expected)
          Checks if the JXPath context's selectNodes() method was called as often as expected.
 void setUp()
           
 void testCreateContext()
          Tests if the used JXPathContext is correctly initialized.
 void testNodeKeyAttribute()
          Tests nodeKey() for an attribute node.
 void testNodeKeyForRootChild()
          Tests node key() for direct children of the root node.
 void testNodeKeyForRootNode()
          Tests nodeKey() for the root node.
 void testNodeKeyNormal()
          Tests a normal call of nodeKey().
 void testPrepareAddAttribute()
          Tests adding a new attribute node.
 void testPrepareAddAttributePath()
          Tests adding a complete path whose final node is an attribute.
 void testPrepareAddEmptyKey()
          Tests an add operation where the key is null.
 void testPrepareAddEmptyPath()
          Tests an add operation with an empty path for the new node.
 void testPrepareAddInvalidAttributePath()
          Tests an add operation with an invalid path: the path contains an attribute in the middle part.
 void testPrepareAddInvalidAttributePath2()
          Tests an add operation with an invalid path: the path contains an attribute after a slash.
 void testPrepareAddInvalidParent()
          Tests an add operation with a query that does not return a single node.
 void testPrepareAddInvalidPath()
          Tests an add operation with an invalid path.
 void testPrepareAddInvalidPathMultipleAttributes()
          Tests an add operation with an invalid path that contains multiple attribute components.
 void testPrepareAddInvalidPathWithSlash()
          Tests an add operation with an invalid path that starts with a slash.
 void testPrepareAddNode()
          Tests adding a single child node.
 void testPrepareAddNullKey()
          Tests an add operation where the key is null.
 void testPrepareAddPath()
          Tests adding a complete path.
 void testPrepareAddRootAttribute()
          Tests adding a new attribute to the root.
 void testPrepareAddRootChild()
          Tests adding a new node to the root.
 void testQueryExpression()
          Tests the query() method with a normal expression.
 void testQueryWithEmptyKey()
          Tests a query with an empty key.
 void testQueryWithNullKey()
          Tests a query with a null key.
 void testQueryWithoutResult()
          Tests a query that has no results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestXPathExpressionEngine

public TestXPathExpressionEngine()
Method Detail

setUp

public void setUp()
           throws Exception
Throws:
Exception

testQueryExpression

public void testQueryExpression()
Tests the query() method with a normal expression.


testQueryWithoutResult

public void testQueryWithoutResult()
Tests a query that has no results. This should return an empty list.


testQueryWithEmptyKey

public void testQueryWithEmptyKey()
Tests a query with an empty key. This should directly return the root node without invoking the JXPathContext.


testQueryWithNullKey

public void testQueryWithNullKey()
Tests a query with a null key. Same as an empty key.


testCreateContext

public void testCreateContext()
Tests if the used JXPathContext is correctly initialized.


testNodeKeyNormal

public void testNodeKeyNormal()
Tests a normal call of nodeKey().


testNodeKeyAttribute

public void testNodeKeyAttribute()
Tests nodeKey() for an attribute node.


testNodeKeyForRootNode

public void testNodeKeyForRootNode()
Tests nodeKey() for the root node.


testNodeKeyForRootChild

public void testNodeKeyForRootChild()
Tests node key() for direct children of the root node.


testPrepareAddNode

public void testPrepareAddNode()
Tests adding a single child node.


testPrepareAddAttribute

public void testPrepareAddAttribute()
Tests adding a new attribute node.


testPrepareAddPath

public void testPrepareAddPath()
Tests adding a complete path.


testPrepareAddAttributePath

public void testPrepareAddAttributePath()
Tests adding a complete path whose final node is an attribute.


testPrepareAddRootChild

public void testPrepareAddRootChild()
Tests adding a new node to the root.


testPrepareAddRootAttribute

public void testPrepareAddRootAttribute()
Tests adding a new attribute to the root.


testPrepareAddInvalidParent

public void testPrepareAddInvalidParent()
Tests an add operation with a query that does not return a single node.


testPrepareAddEmptyPath

public void testPrepareAddEmptyPath()
Tests an add operation with an empty path for the new node.


testPrepareAddNullKey

public void testPrepareAddNullKey()
Tests an add operation where the key is null.


testPrepareAddEmptyKey

public void testPrepareAddEmptyKey()
Tests an add operation where the key is null.


testPrepareAddInvalidPath

public void testPrepareAddInvalidPath()
Tests an add operation with an invalid path.


testPrepareAddInvalidAttributePath

public void testPrepareAddInvalidAttributePath()
Tests an add operation with an invalid path: the path contains an attribute in the middle part.


testPrepareAddInvalidAttributePath2

public void testPrepareAddInvalidAttributePath2()
Tests an add operation with an invalid path: the path contains an attribute after a slash.


testPrepareAddInvalidPathWithSlash

public void testPrepareAddInvalidPathWithSlash()
Tests an add operation with an invalid path that starts with a slash.


testPrepareAddInvalidPathMultipleAttributes

public void testPrepareAddInvalidPathMultipleAttributes()
Tests an add operation with an invalid path that contains multiple attribute components.


checkSelectCalls

protected void checkSelectCalls(int expected)
Checks if the JXPath context's selectNodes() method was called as often as expected.

Parameters:
expected - the number of expected calls


Copyright © 2001-2012 The Apache Software Foundation. All Rights Reserved.