You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by dm...@apache.org on 2003/01/20 01:00:30 UTC

cvs commit: jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/util BasicTypeConverterTest.java

dmitri      2003/01/19 16:00:29

  Modified:    jxpath/src/java/org/apache/commons/jxpath/ri
                        JXPathCompiledExpression.java
               jxpath/src/test/org/apache/commons/jxpath
                        JXPathTestCase.java JXPathTestSuite.java
                        NestedTestBean.java TestBean.java
                        TestMixedModelBean.java TestNull.java Vendor.xml
               jxpath/src/test/org/apache/commons/jxpath/ri/axes
                        SimplePathInterpreterTest.java
                        TestBeanWithNode.java
               jxpath/src/test/org/apache/commons/jxpath/ri/compiler
                        ContextDependencyTest.java CoreFunctionTest.java
                        CoreOperationTest.java ExtensionFunctionTest.java
                        TestFunctions.java TestFunctions2.java
                        VariableFactory.java VariableTest.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model
                        BeanModelTestCase.java
                        ExceptionPropertyTestBean.java MixedModelTest.java
                        TestMixedModelFactory.java XMLModelTestCase.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model/beans
                        BeanModelTest.java TestBeanFactory.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model/dom
                        DOMModelTest.java TestDOMFactory.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model/dynabeans
                        DynaBeanModelTest.java TestDynaBeanFactory.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model/dynamic
                        DynamicPropertiesModelTest.java
                        TestDynamicPropertyFactory.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model/jdom
                        JDOMModelTest.java TestJDOMFactory.java
               jxpath/src/test/org/apache/commons/jxpath/util
                        BasicTypeConverterTest.java
  Added:       jxpath/src/test/org/apache/commons/jxpath/ri
                        JXPathCompiledExpressionTest.java
  Log:
  Placated stylecheck
  
  Revision  Changes    Path
  1.6       +12 -0     jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/JXPathCompiledExpression.java
  
  Index: JXPathCompiledExpression.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/JXPathCompiledExpression.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JXPathCompiledExpression.java	11 Jan 2003 05:41:22 -0000	1.5
  +++ JXPathCompiledExpression.java	20 Jan 2003 00:00:26 -0000	1.6
  @@ -82,6 +82,18 @@
           this.expression = expression;
       }
   
  +    protected String getXPath() {
  +        return xpath;
  +    }
  +
  +    protected Expression getExpression() {
  +        return expression;
  +    }
  +
  +    public String toString() {
  +        return xpath;
  +    }
  +    
       /**
        * @see CompiledExpression#getValue(JXPathContext)
        */
  
  
  
  1.31      +49 -35    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/JXPathTestCase.java
  
  Index: JXPathTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/JXPathTestCase.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- JXPathTestCase.java	26 Nov 2002 01:20:08 -0000	1.30
  +++ JXPathTestCase.java	20 Jan 2003 00:00:26 -0000	1.31
  @@ -62,7 +62,13 @@
   
   package org.apache.commons.jxpath;
   
  -import java.util.*;
  +import java.util.ArrayList;
  +import java.util.Collection;
  +import java.util.Collections;
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Set;
   
   import junit.framework.TestCase;
   
  @@ -75,15 +81,13 @@
    * @version $Revision$ $Date$
    */
   
  -public abstract class JXPathTestCase extends TestCase
  -{
  +public abstract class JXPathTestCase extends TestCase {
       /**
        * Construct a new instance of this test case.
        *
        * @param name Name of the test case
        */
  -    public JXPathTestCase(String name)
  -    {
  +    public JXPathTestCase(String name) {
           super(name);
       }
       
  @@ -185,73 +189,82 @@
                   String xpath, Collection expected)
       {
           Collection actual;
  -        if (expected instanceof List){
  +        if (expected instanceof List) {
               actual = new ArrayList();
           }
           else {
               actual = new HashSet();
           }
           Iterator it = ctx.iterate(xpath);
  -        while (it.hasNext()){
  +        while (it.hasNext()) {
               actual.add(it.next());
           }
           assertEquals("Evaluating value iterator <" + xpath + ">",
                   expected, actual);
       }
   
  -    protected void assertXPathPointerIterator(JXPathContext ctx,
  -                String xpath, Collection expected)
  +    protected void assertXPathPointerIterator(
  +        JXPathContext ctx,
  +        String xpath,
  +        Collection expected) 
       {
           Collection actual;
  -        if (expected instanceof List){
  +        if (expected instanceof List) {
               actual = new ArrayList();
           }
           else {
               actual = new HashSet();
           }
           Iterator it = ctx.iteratePointers(xpath);
  -        while (it.hasNext()){
  -            Pointer pointer = (Pointer)it.next();
  +        while (it.hasNext()) {
  +            Pointer pointer = (Pointer) it.next();
               actual.add(pointer.toString());
           }
  -        assertEquals("Evaluating pointer iterator <" + xpath + ">",
  -                expected, actual);
  +        assertEquals(
  +            "Evaluating pointer iterator <" + xpath + ">",
  +            expected,
  +            actual);
       }
   
  -    protected void assertDocumentOrder(JXPathContext context, 
  -            String path1, String path2, int expected)
  +    protected void assertDocumentOrder(
  +        JXPathContext context,
  +        String path1,
  +        String path2,
  +        int expected) 
       {
  -        NodePointer np1 = (NodePointer)context.getPointer(path1);
  -        NodePointer np2 = (NodePointer)context.getPointer(path2);
  +        NodePointer np1 = (NodePointer) context.getPointer(path1);
  +        NodePointer np2 = (NodePointer) context.getPointer(path2);
           int res = np1.compareTo(np2);
  -        if (res < 0){
  +        if (res < 0) {
               res = -1;
           }
  -        else if (res > 0){
  +        else if (res > 0) {
               res = 1;
           }
  -        assertEquals("Comparing paths '" + path1 + "' and '" + path2 + "'", 
  -                expected, res);
  -    }    
  +        assertEquals(
  +            "Comparing paths '" + path1 + "' and '" + path2 + "'",
  +            expected,
  +            res);
  +    }
   
  -    protected static List list(){
  +    protected static List list() {
           return Collections.EMPTY_LIST;
       }
   
  -    protected static List list(Object o1){
  +    protected static List list(Object o1) {
           List list = new ArrayList();
           list.add(o1);
           return list;
       }
   
  -    protected static List list(Object o1, Object o2){
  +    protected static List list(Object o1, Object o2) {
           List list = new ArrayList();
           list.add(o1);
           list.add(o2);
           return list;
       }
   
  -    protected static List list(Object o1, Object o2, Object o3){
  +    protected static List list(Object o1, Object o2, Object o3) {
           List list = new ArrayList();
           list.add(o1);
           list.add(o2);
  @@ -259,7 +272,7 @@
           return list;
       }
   
  -    protected static Set set(Object o1, Object o2, Object o3){
  +    protected static Set set(Object o1, Object o2, Object o3) {
           Set list = new HashSet();
           list.add(o1);
           list.add(o2);
  @@ -267,7 +280,7 @@
           return list;
       }
   
  -    protected static List list(Object o1, Object o2, Object o3, Object o4){
  +    protected static List list(Object o1, Object o2, Object o3, Object o4) {
           List list = new ArrayList();
           list.add(o1);
           list.add(o2);
  @@ -276,7 +289,7 @@
           return list;
       }
   
  -    protected static Set set(Object o1, Object o2, Object o3, Object o4){
  +    protected static Set set(Object o1, Object o2, Object o3, Object o4) {
           Set list = new HashSet();
           list.add(o1);
           list.add(o2);
  @@ -298,7 +311,8 @@
       }
   
       protected static Set set(Object o1, Object o2, Object o3, 
  -                Object o4, Object o5){
  +                Object o4, Object o5) 
  +    {
           Set list = new HashSet();
           list.add(o1);
           list.add(o2);
  
  
  
  1.3       +9 -9      jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/JXPathTestSuite.java
  
  Index: JXPathTestSuite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/JXPathTestSuite.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JXPathTestSuite.java	28 Nov 2002 01:02:05 -0000	1.2
  +++ JXPathTestSuite.java	20 Jan 2003 00:00:26 -0000	1.3
  @@ -67,6 +67,7 @@
   import junit.framework.TestSuite;
   import junit.textui.TestRunner;
   
  +import org.apache.commons.jxpath.ri.JXPathCompiledExpressionTest;
   import org.apache.commons.jxpath.ri.axes.SimplePathInterpreterTest;
   import org.apache.commons.jxpath.ri.compiler.ContextDependencyTest;
   import org.apache.commons.jxpath.ri.compiler.CoreFunctionTest;
  @@ -98,8 +99,7 @@
    * @version $Revision$ $Date$
    */
   
  -public class JXPathTestSuite extends TestCase
  -{
  +public class JXPathTestSuite extends TestCase {
       private static boolean enabled = true;
   
       /**
  @@ -109,16 +109,16 @@
           TestRunner.run(suite());
       }
   
  -    public JXPathTestSuite(String name){
  +    public JXPathTestSuite(String name) {
           super(name);
       }
   
       /**
        * Return the tests included in this test suite.
        */
  -    public static Test suite()
  -    {
  +    public static Test suite() {
           TestSuite suite = new TestSuite();
  +        suite.addTestSuite(JXPathCompiledExpressionTest.class);
           suite.addTestSuite(SimplePathInterpreterTest.class);
           suite.addTestSuite(ContextDependencyTest.class);
           suite.addTestSuite(CoreFunctionTest.class);
  
  
  
  1.5       +16 -15    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/NestedTestBean.java
  
  Index: NestedTestBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/NestedTestBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NestedTestBean.java	13 Oct 2002 03:25:48 -0000	1.4
  +++ NestedTestBean.java	20 Jan 2003 00:00:26 -0000	1.5
  @@ -71,53 +71,54 @@
       private String name = "Name 0";
       private int integer = 1;
   
  -    public NestedTestBean(){
  +    public NestedTestBean() {
       }
   
  -    public NestedTestBean(String name){
  +    public NestedTestBean(String name) {
           this.name = name;
       }
   
  -    public void setName(String name){
  +    public void setName(String name) {
           this.name = name;
       }
   
       /**
        * A read-only boolean property
        */
  -    public boolean isBoolean(){
  +    public boolean isBoolean() {
           return false;
       }
   
       /**
        * A read-only int property
        */
  -    public int getInt(){
  +    public int getInt() {
           return integer;
       }
   
  -    public void setInt(int value){
  +    public void setInt(int value) {
           this.integer = value;
       }
   
       /**
        * A read-only String property
        */
  -    public String getName(){
  +    public String getName() {
           return name;
       }
   
  -    private String[] strings = new String[]{"String 1", "String 2", "String 3"};
  +    private String[] strings =
  +        new String[] { "String 1", "String 2", "String 3" };
   
  -    public String[] getStrings(){
  +    public String[] getStrings() {
           return strings;
       }
   
  -    public void setStrings(String[] array){
  +    public void setStrings(String[] array) {
           strings = array;
       }
   
  -    public String toString(){
  +    public String toString() {
           return "Nested: " + name;
       }
   }
  
  
  
  1.5       +30 -26    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/TestBean.java
  
  Index: TestBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/TestBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestBean.java	11 Jan 2003 05:41:27 -0000	1.4
  +++ TestBean.java	20 Jan 2003 00:00:26 -0000	1.5
  @@ -62,7 +62,12 @@
   
   package org.apache.commons.jxpath;
   
  -import java.util.*;
  +import java.util.ArrayList;
  +import java.util.HashMap;
  +import java.util.HashSet;
  +import java.util.List;
  +import java.util.Map;
  +import java.util.Set;
   
   import org.apache.commons.jxpath.util.ValueUtils;
   
  @@ -76,7 +81,6 @@
   
       // ------------------------------------------------------------- Properties
   
  -
       /**
        * An array of nested java beans.
        */
  @@ -88,11 +92,11 @@
           beans[1].setInt(3);
       }
   
  -    public NestedTestBean[] getBeans(){
  +    public NestedTestBean[] getBeans() {
           return beans;
       }
   
  -    public void setBeans(NestedTestBean[] beans){
  +    public void setBeans(NestedTestBean[] beans) {
           this.beans = beans;
       }
   
  @@ -100,11 +104,11 @@
        * A boolean property.
        */
       private boolean bool = false;
  -    public boolean getBoolean(){
  +    public boolean getBoolean() {
           return bool;
       }
   
  -    public void setBoolean(boolean bool){
  +    public void setBoolean(boolean bool) {
           this.bool = bool;
       }
   
  @@ -112,29 +116,29 @@
       /**
        * A read-only integer property
        */
  -    public int getInt(){
  +    public int getInt() {
           return integer;
       }
   
  -    public void setInt(int integer){
  +    public void setInt(int integer) {
           this.integer = integer;
       }
   
       /**
        * A read-only array of integers
        */
  -    private int[] array = {1, 2, 3, 4};
  -    public int[] getIntegers(){
  +    private int[] array = { 1, 2, 3, 4 };
  +    public int[] getIntegers() {
           return array;
       }
   
  -    public int getIntegers(int index){
  +    public int getIntegers(int index) {
           return array[index];
       }
   
  -    public void setIntegers(int index, int value){
  -        if (index >= array.length){
  -            array = (int[])ValueUtils.expandCollection(array, index + 1);
  +    public void setIntegers(int index, int value) {
  +        if (index >= array.length) {
  +            array = (int[]) ValueUtils.expandCollection(array, index + 1);
           }
           array[index] = value;
       }
  @@ -143,8 +147,8 @@
        * A heterogeneous list: String, Integer, NestedTestBean
        */
       private ArrayList list;
  -    public List getList(){
  -        if (list == null){
  +    public List getList() {
  +        if (list == null) {
               list = new ArrayList();
               list.add("String 3");
               list.add(new Integer(3));
  @@ -163,23 +167,23 @@
           map.put("Key2", new NestedTestBean("Name 6"));
       }
   
  -    public Map getMap(){
  +    public Map getMap() {
           return map;
       }
   
  -    public void setMap(Map map){
  -        this.map = (HashMap)map;
  +    public void setMap(Map map) {
  +        this.map = (HashMap) map;
       }
   
       /**
        * A nested read-only java bean
        */
       private NestedTestBean nestedBean = new NestedTestBean("Name 0");
  -    public NestedTestBean getNestedBean(){
  +    public NestedTestBean getNestedBean() {
           return nestedBean;
       }
   
  -    public void setNestedBean(NestedTestBean bean){
  +    public void setNestedBean(NestedTestBean bean) {
           this.nestedBean = bean;
       }
   
  @@ -188,14 +192,14 @@
       /**
        * Returns a NestedTestBean: testing recognition of generic objects
        */
  -    public Object getObject(){
  +    public Object getObject() {
           return object;
       }
   
       /**
        * Returns an array of ints: testing recognition of generic objects
        */
  -    public Object getObjects(){
  +    public Object getObjects() {
           return getIntegers();
       }
   
  @@ -203,8 +207,8 @@
        * A heterogeneous set: String, Integer, NestedTestBean
        */
       private HashSet set;
  -    public Set getSet(){
  -        if (set == null){
  +    public Set getSet() {
  +        if (set == null) {
               set = new HashSet();
               set.add("String 4");
               set.add(new Integer(4));
  @@ -213,7 +217,7 @@
           return set;
       }
   
  -    public String toString(){
  +    public String toString() {
           return "ROOT";
       }
   }
  
  
  
  1.4       +20 -16    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/TestMixedModelBean.java
  
  Index: TestMixedModelBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/TestMixedModelBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestMixedModelBean.java	11 Jan 2003 05:41:27 -0000	1.3
  +++ TestMixedModelBean.java	20 Jan 2003 00:00:27 -0000	1.4
  @@ -62,7 +62,11 @@
   
   package org.apache.commons.jxpath;
   
  -import java.util.*;
  +import java.util.ArrayList;
  +import java.util.Collections;
  +import java.util.HashMap;
  +import java.util.List;
  +import java.util.Map;
   
   import org.apache.commons.jxpath.xml.DocumentContainer;
   import org.w3c.dom.Document;
  @@ -86,14 +90,14 @@
       private List list;
       private int[][] matrix;
   
  -    public TestMixedModelBean(){
  +    public TestMixedModelBean() {
           string = "string";
           bean = new TestBean();
           map = new HashMap();
           list = new ArrayList();
   
           container = new DocumentContainer(getClass().getResource("Vendor.xml"));
  -        document = (Document)container.getValue();
  +        document = (Document) container.getValue();
           element = document.getDocumentElement();
   
           map.put("string", string);
  @@ -111,45 +115,45 @@
           list.add(document);
           list.add(element);
           list.add(container);
  -        
  +
           matrix = new int[1][];
           matrix[0] = new int[1];
           matrix[0][0] = 3;
       }
   
  -    public String getString(){
  +    public String getString() {
           return string;
       }
  -    
  +
       public TestBean getBean() {
           return bean;
       }
  -    
  -    public Map getMap(){
  +
  +    public Map getMap() {
           return map;
       }
   
       public List getList() {
           return list;
       }
  -        
  +
       public Document getDocument() {
           return document;
       }
  -    
  +
       public Element getElement() {
           return element;
       }
  -    
  -    public Container getContainer(){
  +
  +    public Container getContainer() {
           return container;
       }
  -    
  -    public int[][] getMatrix(){
  +
  +    public int[][] getMatrix() {
           return matrix;
       }
  -    
  -    public void setMatrix(int[][] matrix){
  +
  +    public void setMatrix(int[][] matrix) {
           this.matrix = matrix;
       }
   }
  
  
  
  1.3       +10 -10    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/TestNull.java
  
  Index: TestNull.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/TestNull.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestNull.java	26 Nov 2002 01:20:08 -0000	1.2
  +++ TestNull.java	20 Jan 2003 00:00:27 -0000	1.3
  @@ -72,25 +72,25 @@
   public class TestNull {
   
       private Object nothing = null;
  -    public Object getNothing(){
  +    public Object getNothing() {
           return nothing;
       }
   
  -    public void setNothing(Object something){
  +    public void setNothing(Object something) {
           this.nothing = something;
       }
   
       /**
        */
  -    private static String[] array = {"a", null, "b"};
  -    public String[] getArray(){
  +    private static String[] array = { "a", null, "b" };
  +    public String[] getArray() {
           return array;
       }
   
       private TestNull child;
   
  -    public TestNull getChild(){
  -        if (child == null){
  +    public TestNull getChild() {
  +        if (child == null) {
               child = new TestNull();
           }
           return child;
  
  
  
  1.8       +0 -25     jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/Vendor.xml
  
  Index: Vendor.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/Vendor.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Vendor.xml	12 Jan 2003 05:21:50 -0000	1.7
  +++ Vendor.xml	20 Jan 2003 00:00:27 -0000	1.8
  @@ -46,29 +46,4 @@
        <?security do not show anybody ?>
        <?report average only ?>
     </product>
  -
  -  <inventory>
  -    <name>Watermelon</name>
  -    <department>
  -      <name>Fruit</name>
  -      <count>20</count>
  -    </department>
  -    <department>
  -      <name>Vegetables</name>
  -      <count>3</count>
  -    </department>
  -  </inventory>
  -
  -  <inventory>
  -    <name>Cantaloupe</name>
  -    <department>
  -      <name>Fruit</name>
  -      <count>10</count>
  -    </department>
  -    <department>
  -      <name>Vegetables</name>
  -      <count>100</count>
  -    </department>
  -  </inventory>
  -
   </vendor>
  
  
  
  1.1                  jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/JXPathCompiledExpressionTest.java
  
  Index: JXPathCompiledExpressionTest.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/JXPathCompiledExpressionTest.java,v 1.1 2003/01/20 00:00:27 dmitri Exp $
   * $Revision: 1.1 $
   * $Date: 2003/01/20 00:00:27 $
   *
   * ====================================================================
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowlegement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 2001, Plotnix, Inc,
   * <http://www.plotnix.com/>.
   * For more information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.commons.jxpath.ri;
  
  import org.apache.commons.jxpath.JXPathContext;
  import org.apache.commons.jxpath.JXPathTestCase;
  import org.apache.commons.jxpath.ri.compiler.*;
  
  /**
   * Test compiler.
   *
   * @author Dmitri Plotnikov
   * @version $Revision: 1.1 $ $Date: 2003/01/20 00:00:27 $
   */
  
  public class JXPathCompiledExpressionTest extends JXPathTestCase {
      
      /**
       * Construct a new instance of this test case.
       *
       * @param name Name of the test case
       */
      public JXPathCompiledExpressionTest(String name) {
          super(name);
      }
  
      public void testConstant() {
          assertXPathExpression("1", Constant.class);
          assertXPathExpression("1.5", Constant.class);
          assertXPathExpression("'foo'", Constant.class);
      }
      
      public void testCoreFunction() {
          assertXPathExpression("last()", CoreFunction.class);
          assertXPathExpression("position()", CoreFunction.class);
          assertXPathExpression("count(book)", CoreFunction.class);
          assertXPathExpression("id(13)", CoreFunction.class);
          assertXPathExpression("local-name()", CoreFunction.class);
          assertXPathExpression("local-name(book)", CoreFunction.class);
          assertXPathExpression("namespace-uri()", CoreFunction.class);
          assertXPathExpression("namespace-uri(book)", CoreFunction.class);
          assertXPathExpression("name()", CoreFunction.class);
          assertXPathExpression("name(book)", CoreFunction.class);
          assertXPathExpression("string(3)", CoreFunction.class);
          assertXPathExpression("concat('a', 'b')", CoreFunction.class);
          assertXPathExpression("starts-with('a', 'b')", CoreFunction.class);
          assertXPathExpression("contains('a', 'b')", CoreFunction.class);
          assertXPathExpression("substring-before('a', 1)", CoreFunction.class);
          assertXPathExpression("substring-after('a', 2)", CoreFunction.class);
          assertXPathExpression("substring('a', 2)", CoreFunction.class);
          assertXPathExpression("substring('a', 2, 3)", CoreFunction.class);
          assertXPathExpression("string-length('a')", CoreFunction.class);
          assertXPathExpression("normalize-space('a')", CoreFunction.class);
          assertXPathExpression("translate('a', 'b', 'c')", CoreFunction.class);
          assertXPathExpression("boolean('true')", CoreFunction.class);
          assertXPathExpression("not(1)", CoreFunction.class);
          assertXPathExpression("true()", CoreFunction.class);
          assertXPathExpression("false()", CoreFunction.class);
          assertXPathExpression("lang('fr')", CoreFunction.class);
          assertXPathExpression("number('12')", CoreFunction.class);
          assertXPathExpression("sum(book/price)", CoreFunction.class);
          assertXPathExpression("floor(11.4)", CoreFunction.class);
          assertXPathExpression("ceiling(11.4)", CoreFunction.class);
          assertXPathExpression("round(11.4)", CoreFunction.class);
          assertXPathExpression("key('title', 'Hobbit')", CoreFunction.class);
      }
      
      public void testCoreOperationAnd() {
          assertXPathExpression(
              "2 and 4",
              CoreOperationAnd.class);
  
          assertXPathExpression(
              "2 > 1 and 4 < 5",
              CoreOperationAnd.class);            
      }
          
      public void testCoreOperationOr() {
          assertXPathExpression(
              "2 or 4",
              CoreOperationOr.class);
  
          assertXPathExpression(
              "2 > 1 or 4 < 5",
              CoreOperationOr.class);
  
          assertXPathExpression(
              "1 > 1 and 2 <= 2 or 3 = 4",
              CoreOperationOr.class);
      }
  
      public void testCoreOperationEqual() {
          assertXPathExpression(
              "2 = 4",
              CoreOperationEqual.class);
  
          assertXPathExpression(
              "2 + 1 = 3",
              CoreOperationEqual.class);
      }
      
      public void testCoreOperationNameAttributeTest() {
          assertXPathExpression(
              "@name = 'bar'",
              NameAttributeTest.class);
      }
  
      public void testCoreOperationNotEqual() {
          assertXPathExpression(
              "2 != 4",
              CoreOperationNotEqual.class);
  
          assertXPathExpression(
              "2 + 1 != 3",
              CoreOperationNotEqual.class);
      }
  
      public void testCoreOperationLessThan() {
          assertXPathExpression(
              "3<4",
              CoreOperationLessThan.class,
              "3 < 4");
  
          assertXPathExpression(
              "3<(2>=1)",
              CoreOperationLessThan.class,
              "3 < (2 >= 1)");
      }
      
      public void testCoreOperationLessThanOrEqual() {
          assertXPathExpression(
              "3<=4",
              CoreOperationLessThanOrEqual.class,
              "3 <= 4");
  
          assertXPathExpression(
              "3<=(2>=1)",
              CoreOperationLessThanOrEqual.class,
              "3 <= (2 >= 1)");
      }
  
      public void testCoreOperationGreaterThan() {
          assertXPathExpression(
              "3>4",
              CoreOperationGreaterThan.class,
              "3 > 4");
  
          assertXPathExpression(
              "3>(2>=1)",
              CoreOperationGreaterThan.class,
              "3 > (2 >= 1)");
  
          assertXPathExpression(
              "1 > (1 and 2 <= (2 or 3) = 4)",
              CoreOperationGreaterThan.class);
      }
      
      public void testCoreOperationGreaterThanOrEqual() {
          assertXPathExpression(
              "3>=4",
              CoreOperationGreaterThanOrEqual.class,
              "3 >= 4");
  
          assertXPathExpression(
              "3>=(2>=1)",
              CoreOperationGreaterThanOrEqual.class,
              "3 >= (2 >= 1)");
      }
  
      public void testCoreOperationDivide() {
          assertXPathExpression(
              "2 div 4",
              CoreOperationDivide.class);
  
          assertXPathExpression(
              "2|3 div -3",
              CoreOperationDivide.class,
              "2 | 3 div -3");
      }
  
      public void testCoreOperationMod() {
          assertXPathExpression(
              "2 mod 4",
              CoreOperationMod.class);
  
          assertXPathExpression(
              "2|3 mod -3",
              CoreOperationMod.class,
              "2 | 3 mod -3");
      }
  
      public void testCoreOperationMultiply() {
          assertXPathExpression(
              "2*4",
              CoreOperationMultiply.class,
              "2 * 4");
              
          assertXPathExpression(
              "2*(3 + 1)",
              CoreOperationMultiply.class,
              "2 * (3 + 1)");
      }
      
      public void testCoreOperationMinus() {
          assertXPathExpression(
              "1 - 1",
              CoreOperationSubtract.class);
              
          assertXPathExpression(
              "1 - 1 - 2",
              CoreOperationSubtract.class);
              
          assertXPathExpression(
              "1 - (1 - 2)",
              CoreOperationSubtract.class);
      }
      
      public void testCoreOperationSum() {
          assertXPathExpression(
              "3 + 1 + 4", 
              CoreOperationAdd.class);
              
          assertXPathExpression(
              "(3 + 1) + 4",
              CoreOperationAdd.class,
              "3 + 1 + 4");
              
          assertXPathExpression(
              "3 + (1 + 4)",
              CoreOperationAdd.class,
              "3 + 1 + 4");
              
          assertXPathExpression(
              "3 + -1", 
              CoreOperationAdd.class, 
              "3 + -1");
              
          assertXPathExpression(
              "2*-3 + -1",
              CoreOperationAdd.class,
              "2 * -3 + -1");
      }
      
      public void testCoreOperationUnaryMinus() {
          assertXPathExpression("-3", CoreOperationNegate.class);
          assertXPathExpression("-(3 + 1)", CoreOperationNegate.class);
      }
  
      public void testCoreOperationUnion() {
          assertXPathExpression(
              "3 | 1 | 4",
              CoreOperationUnion.class);
      }
      
      public void testExpressionPath() {
          assertXPathExpression(
              "$x/foo/bar",
              ExpressionPath.class);        
          assertXPathExpression(
              "(2 + 2)/foo/bar",
              ExpressionPath.class);        
          assertXPathExpression(
              "$x[3][2 + 2]/foo/bar",
              ExpressionPath.class);        
      }
      
      public void testExtensionFunction() {
          assertXPathExpression(
              "my:function(3, other.function())",
              ExtensionFunction.class);        
      }
   
      public void testLocationPathAxisSelf() {
          assertXPathExpression(
              "self::foo:bar",
              LocationPath.class);
                   
          assertXPathExpression(
              ".",
              LocationPath.class);     
      }
      
      public void testLocationPathAxisChild() {
          assertXPathExpression(
              "child::foo:bar",
              LocationPath.class,
              "foo:bar");
                   
          assertXPathExpression(
              "foo:bar",
              LocationPath.class);
                   
          assertXPathExpression(
              "/foo:bar",
              LocationPath.class);
                   
          assertXPathExpression(
              "/foo/bar",
              LocationPath.class);     
  
          assertXPathExpression(
              "*",
              LocationPath.class);
                   
          assertXPathExpression(
              "foo:*",
              LocationPath.class);
                   
      }
      
      public void testLocationPathAxisParent() {
          assertXPathExpression(
              "parent::foo:bar",
              LocationPath.class);
                   
          assertXPathExpression(
              "..",
              LocationPath.class);     
      }
      
      public void testLocationPathAxisAttribute() {
          assertXPathExpression(
              "attribute::foo:bar",
              LocationPath.class,
              "@foo:bar");
  
          assertXPathExpression(
              "@foo:bar",
              LocationPath.class);
  
          assertXPathExpression(
              "../@foo:bar",
              LocationPath.class);
  
          assertXPathExpression(
              "@*",
              LocationPath.class);
  
          assertXPathExpression(
              "@*[last()]",
              LocationPath.class);
      }
      
      public void testLocationPathAxisDescendant() {
          assertXPathExpression(
              "descendant::foo:bar",
              LocationPath.class);
      }
      
      public void testLocationPathAxisDescendantOrSelf() {
          assertXPathExpression(
              "descendant-or-self::foo:bar",
              LocationPath.class);
  
          assertXPathExpression(
              "//foo", 
              LocationPath.class);
  
          assertXPathExpression(
              "foo//bar", 
              LocationPath.class);
      }
      
      public void testLocationPathAxisOther() {
          assertXPathExpression(
              "ancestor::foo:bar",
              LocationPath.class);
              
          assertXPathExpression(
              "ancestor-or-self::foo:bar",
              LocationPath.class);
              
          assertXPathExpression(
              "namespace::foo:bar",
              LocationPath.class);
  
          assertXPathExpression(
              "preceding::foo:bar",
              LocationPath.class);
  
          assertXPathExpression(
              "preceding-sibling::foo:bar",
              LocationPath.class);
  
          assertXPathExpression(
              "following::foo:bar",
              LocationPath.class);
  
          assertXPathExpression(
              "following-sibling::foo:bar",
              LocationPath.class);
      }
      
      public void testLocationPathNodeTest() {
          assertXPathExpression(
              "node()",
              LocationPath.class);
  
          assertXPathExpression(
              "text()",
              LocationPath.class);
  
          assertXPathExpression(
              "comment()",
              LocationPath.class);
  
          assertXPathExpression(
              "processing-instruction()",
              LocationPath.class);
  
          assertXPathExpression(
              "processing-instruction('test')",
              LocationPath.class);
      }
      
      public void testVariableReference() {
          assertXPathExpression(
              "$x",
              VariableReference.class);                
  
          assertXPathExpression(
              "$x:y",
              VariableReference.class);
      }
      
      /**
       * Compiles the xpath into an Expression, checks the expression
       * class, converts the expression to string and checks that the string
       * matches the expected one.
       */
      private void assertXPathExpression(
          String xpath,
          Class expectedClass,
          String expected) 
      {
          JXPathCompiledExpression expression =
              (JXPathCompiledExpression) JXPathContext.compile(xpath);
          
          assertEquals(
              "Expression class for " + xpath,
              expectedClass,
              expression.getExpression().getClass());
              
          assertEquals(
              "Expression toString() for " + xpath,
              expected,
              expression.getExpression().toString());
      }
      
      private void assertXPathExpression(
          String xpath,
          Class expectedClass) 
      {
          assertXPathExpression(xpath, expectedClass, xpath);
      }
      
  }
  
  
  1.5       +39 -31    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/axes/SimplePathInterpreterTest.java
  
  Index: SimplePathInterpreterTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/axes/SimplePathInterpreterTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimplePathInterpreterTest.java	28 Nov 2002 01:02:05 -0000	1.4
  +++ SimplePathInterpreterTest.java	20 Jan 2003 00:00:27 -0000	1.5
  @@ -1,17 +1,25 @@
   package org.apache.commons.jxpath.ri.axes;
   
  +import java.util.HashMap;
  +
   import junit.framework.TestCase;
   
   import org.apache.commons.jxpath.JXPathContext;
  +import org.apache.commons.jxpath.NestedTestBean;
   import org.apache.commons.jxpath.Pointer;
   import org.apache.commons.jxpath.TestNull;
  -import org.apache.commons.jxpath.NestedTestBean;
  -import org.apache.commons.jxpath.ri.model.*;
  -import org.apache.commons.jxpath.ri.model.beans.*;
  -import org.apache.commons.jxpath.ri.model.dom.*;
  -import org.apache.commons.jxpath.ri.model.dynamic.*;
  -
  -import java.util.*;
  +import org.apache.commons.jxpath.ri.model.NodePointer;
  +import org.apache.commons.jxpath.ri.model.VariablePointer;
  +import org.apache.commons.jxpath.ri.model.beans.BeanPointer;
  +import org.apache.commons.jxpath.ri.model.beans.BeanPropertyPointer;
  +import org.apache.commons.jxpath.ri.model.beans.CollectionPointer;
  +import org.apache.commons.jxpath.ri.model.beans.NullElementPointer;
  +import org.apache.commons.jxpath.ri.model.beans.NullPointer;
  +import org.apache.commons.jxpath.ri.model.beans.NullPropertyPointer;
  +import org.apache.commons.jxpath.ri.model.beans.TestBeanFactory;
  +import org.apache.commons.jxpath.ri.model.dom.DOMNodePointer;
  +import org.apache.commons.jxpath.ri.model.dynamic.DynamicPointer;
  +import org.apache.commons.jxpath.ri.model.dynamic.DynamicPropertyPointer;
   
   public class SimplePathInterpreterTest extends TestCase {
   
  @@ -55,7 +63,7 @@
           context.setFactory(new TestBeanFactory());
       }
   
  -    public void test_doStep_noPredicates_propertyOwner(){
  +    public void testDoStepNoPredicatesPropertyOwner() {
           // Existing scalar property
           assertValueAndPointer("/int",
                   new Integer(1),
  @@ -146,7 +154,7 @@
                   "BbC");
       }
   
  -    public void test_doStep_noPredicates_standard(){
  +    public void testDoStepNoPredicatesStandard() {
           // Existing DOM node
           assertValueAndPointer("/vendor/location/address/city",
                   "Fruit Market",
  @@ -169,7 +177,7 @@
                   "BbMMMMn");
       }
   
  -    public void test_doStep_predicates_propertyOwner(){
  +    public void testDoStepPredicatesPropertyOwner() {
           // missingProperty[@name=foo]
           assertNullPointer("/foo[@name='foo']",
                   "/foo[@name='foo']",
  @@ -181,7 +189,7 @@
                   "Bn");
       }
   
  -    public void test_doStep_predicates_standard(){
  +    public void testDoStepPredicatesStandard() {
           // Looking for an actual XML attribute called "name"
           // nodeProperty/name[@name=value]
           assertValueAndPointer("/vendor/contact[@name='jack']",
  @@ -213,7 +221,7 @@
                   "BbMM");
       }
   
  -    public void test_doPredicate_name(){
  +    public void testDoPredicateName() {
           // existingProperty[@name=existingProperty]
           assertValueAndPointer("/nestedBean[@name='int']",
                   new Integer(1),
  @@ -349,7 +357,7 @@
                   "BbDdM");
       }
   
  -    public void test_doPredicates_standard(){
  +    public void testDoPredicatesStandard() {
           // bean/map/collection/node
           assertValueAndPointer("map[@name='Key3'][@name='fruitco']",
                   context.getValue("/vendor"),
  @@ -390,7 +398,7 @@
                   "BbMM");
       }
   
  -    public void test_doPredicate_index(){
  +    public void testDoPredicateIndex() {
           // Existing dynamic property + existing property + index
           assertValueAndPointer("/map[@name='Key2'][@name='strings'][2]",
                   "String 2",
  @@ -536,7 +544,7 @@
                   "BbB");
       }
   
  -    public void testInterpretExpressionPath(){
  +    public void testInterpretExpressionPath() {
           context.getVariables().declareVariable("array", new String[]{"Value1"});
           context.getVariables().declareVariable("testnull", new TestNull());
   
  @@ -571,7 +579,7 @@
           assertEquals("Checking signature: " + path,
                   expectedSignature, pointerSignature(pointer));
           
  -        Pointer vPointer = ((NodePointer)pointer).getValuePointer();
  +        Pointer vPointer = ((NodePointer) pointer).getValuePointer();
           assertEquals("Checking value pointer signature: " + path,
                   expectedValueSignature, pointerSignature(vPointer));
       }
  @@ -587,9 +595,9 @@
           assertEquals("Checking Signature: " + path,
                       expectedSignature, pointerSignature(pointer));
                   
  -        Pointer vPointer = ((NodePointer)pointer).getValuePointer();
  +        Pointer vPointer = ((NodePointer) pointer).getValuePointer();
           assertTrue("Null path is null: " + path,
  -                    !((NodePointer)vPointer).isActual());
  +                    !((NodePointer) vPointer).isActual());
           assertEquals("Checking value pointer signature: " + path,
                       expectedSignature + "N", pointerSignature(vPointer));
       }
  @@ -599,26 +607,26 @@
        * we will get a signature which will contain a single character
        * per pointer in the chain, representing that pointer's type.
        */
  -    private String pointerSignature(Pointer pointer){
  -        if (pointer == null){
  +    private String pointerSignature(Pointer pointer) {
  +        if (pointer == null) {
               return "";
           }
   
           char type = '?';
  -        if (pointer instanceof NullPointer){                 type = 'N'; }
  -        else if (pointer instanceof NullPropertyPointer){    type = 'n'; }
  -        else if (pointer instanceof NullElementPointer){     type = 'E'; }
  -        else if (pointer instanceof VariablePointer){        type = 'V'; }
  -        else if (pointer instanceof CollectionPointer){      type = 'C'; }
  -        else if (pointer instanceof BeanPointer){            type = 'B'; }
  -        else if (pointer instanceof BeanPropertyPointer){    type = 'b'; }
  -        else if (pointer instanceof DynamicPointer){         type = 'D'; }
  -        else if (pointer instanceof DynamicPropertyPointer){ type = 'd'; }
  -        else if (pointer instanceof DOMNodePointer){         type = 'M'; }
  +        if (pointer instanceof NullPointer) {                 type = 'N'; }
  +        else if (pointer instanceof NullPropertyPointer) {    type = 'n'; }
  +        else if (pointer instanceof NullElementPointer) {     type = 'E'; }
  +        else if (pointer instanceof VariablePointer) {        type = 'V'; }
  +        else if (pointer instanceof CollectionPointer) {      type = 'C'; }
  +        else if (pointer instanceof BeanPointer) {            type = 'B'; }
  +        else if (pointer instanceof BeanPropertyPointer) {    type = 'b'; }
  +        else if (pointer instanceof DynamicPointer) {         type = 'D'; }
  +        else if (pointer instanceof DynamicPropertyPointer) { type = 'd'; }
  +        else if (pointer instanceof DOMNodePointer) {         type = 'M'; }
           else {
               System.err.println("UNKNOWN TYPE: " + pointer.getClass());
           }
  -        return pointerSignature(((NodePointer)pointer).getParent()) + type;
  +        return pointerSignature(((NodePointer) pointer).getParent()) + type;
       }
   }
   
  
  
  
  1.2       +13 -12    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/axes/TestBeanWithNode.java
  
  Index: TestBeanWithNode.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/axes/TestBeanWithNode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestBeanWithNode.java	20 Oct 2002 03:48:22 -0000	1.1
  +++ TestBeanWithNode.java	20 Jan 2003 00:00:27 -0000	1.2
  @@ -77,30 +77,31 @@
       private Object node;
       private Object object;
   
  -    public Object getVendor(){
  +    public Object getVendor() {
           return node;
       }
   
  -    public Object[] getVendors(){
  -        return new Object[]{node};
  +    public Object[] getVendors() {
  +        return new Object[] { node };
       }
   
  -    public void setVendor(Object node){
  +    public void setVendor(Object node) {
           this.node = node;
       }
   
  -    public Object getObject(){
  +    public Object getObject() {
           return object;
       }
   
  -    public void setObject(Object object){
  +    public void setObject(Object object) {
           this.object = object;
       }
   
  -    public static TestBeanWithNode createTestBeanWithDOM(){
  -        DocumentContainer docCtr = new DocumentContainer(
  +    public static TestBeanWithNode createTestBeanWithDOM() {
  +        DocumentContainer docCtr =
  +            new DocumentContainer(
                   JXPathTestCase.class.getResource("Vendor.xml"));
  -        Document doc = (Document)docCtr.getValue();
  +        Document doc = (Document) docCtr.getValue();
           TestBeanWithNode tbwdom = new TestBeanWithNode();
           tbwdom.setVendor(doc.getDocumentElement());
           tbwdom.setObject(docCtr);
  
  
  
  1.2       +15 -15    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/ContextDependencyTest.java
  
  Index: ContextDependencyTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/ContextDependencyTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContextDependencyTest.java	20 Oct 2002 03:48:22 -0000	1.1
  +++ ContextDependencyTest.java	20 Jan 2003 00:00:27 -0000	1.2
  @@ -72,13 +72,12 @@
    * @version $Revision$ $Date$
    */
   
  -public class ContextDependencyTest extends JXPathTestCase
  -{
  -    public ContextDependencyTest(String name){
  +public class ContextDependencyTest extends JXPathTestCase {
  +    public ContextDependencyTest(String name) {
           super(name);
       }
   
  -    public void testContextDependency(){
  +    public void testContextDependency() {
           testContextDependency("1", false);
           testContextDependency("$x", false);
           testContextDependency("/foo", false);
  @@ -91,12 +90,13 @@
           testContextDependency("test:func(3, foo)", true);
       }
   
  -    public void testContextDependency(String xpath, boolean expected){
  -        Expression expr = 
  -            (Expression)Parser.parseExpression(xpath, new TreeCompiler());
  -        
  -        assertEquals("Context dependency <" + xpath + ">", 
  -                expected, 
  -                expr.isContextDependent());
  -    }   
  +    public void testContextDependency(String xpath, boolean expected) {
  +        Expression expr =
  +            (Expression) Parser.parseExpression(xpath, new TreeCompiler());
  +
  +        assertEquals(
  +            "Context dependency <" + xpath + ">",
  +            expected,
  +            expr.isContextDependent());
  +    }
   }
  
  
  
  1.3       +81 -73    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/CoreFunctionTest.java
  
  Index: CoreFunctionTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/CoreFunctionTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CoreFunctionTest.java	26 Nov 2002 01:20:08 -0000	1.2
  +++ CoreFunctionTest.java	20 Jan 2003 00:00:27 -0000	1.3
  @@ -78,8 +78,7 @@
    * @version $Revision$ $Date$
    */
   
  -public class CoreFunctionTest extends JXPathTestCase
  -{
  +public class CoreFunctionTest extends JXPathTestCase {
       private JXPathContext context;
   
       /**
  @@ -87,92 +86,101 @@
        *
        * @param name Name of the test case
        */
  -    public CoreFunctionTest(String name){
  +    public CoreFunctionTest(String name) {
           super(name);
       }
   
  -    public void setUp(){
  -        if (context == null){
  +    public void setUp() {
  +        if (context == null) {
               context = JXPathContext.newContext(new TestMixedModelBean());
               Variables vars = context.getVariables();
               vars.declareVariable("nan", new Double(Double.NaN));
           }
       }
   
  -    public void testCoreFunctions(){
  -        assertXPathValue(context,"string(2)", "2");
  -        assertXPathValue(context,"string($nan)", "NaN");
  -        assertXPathValue(context,"string(-$nan)", "NaN");
  -        assertXPathValue(context,"string(-2 div 0)", "-Infinity");
  -        assertXPathValue(context,"string(2 div 0)", "Infinity");
  -        assertXPathValue(context,"concat('a', 'b', 'c')", "abc");
  -        assertXPathValue(context,"starts-with('abc', 'ab')", Boolean.TRUE);
  -        assertXPathValue(context,"starts-with('xabc', 'ab')", Boolean.FALSE);
  -        assertXPathValue(context,"contains('xabc', 'ab')", Boolean.TRUE);
  -        assertXPathValue(context,"contains('xabc', 'ba')", Boolean.FALSE);
  -        assertXPathValue(context,"substring-before('1999/04/01', '/')", "1999");
  -        assertXPathValue(context,"substring-after('1999/04/01', '/')", "04/01");
  -        assertXPathValue(context,"substring('12345', 2, 3)", "234");
  -        assertXPathValue(context,"substring('12345', 2)", "2345");
  -        assertXPathValue(context,"substring('12345', 1.5, 2.6)", "234");
  -        assertXPathValue(context,"substring('12345', 0, 3)", "12");
  -        assertXPathValue(context,"substring('12345', 0 div 0, 3)", "");
  -        assertXPathValue(context,"substring('12345', 1, 0 div 0)", "");
  -        assertXPathValue(context,"substring('12345', -42, 1 div 0)", "12345");
  -        assertXPathValue(context,"substring('12345', -1 div 0, 1 div 0)", "");
  -        assertXPathValue(context,"string-length('12345')", new Double(5));
  -        assertXPathValue(context,"normalize-space(' abc  def  ')", "abc def");
  -        assertXPathValue(context,"normalize-space('abc def')", "abc def");
  -        assertXPathValue(context,"normalize-space('   ')", "");
  -        assertXPathValue(context,"translate('--aaa--', 'abc-', 'ABC')", "AAA");
  -        assertXPathValue(context,"boolean(1)", Boolean.TRUE);
  -        assertXPathValue(context,"boolean(0)", Boolean.FALSE);
  -        assertXPathValue(context,"boolean('x')", Boolean.TRUE);
  -        assertXPathValue(context,"boolean('')", Boolean.FALSE);
  -        
  -        assertXPathValue(context,"true()", Boolean.TRUE);
  -        assertXPathValue(context,"false()", Boolean.FALSE);
  -        assertXPathValue(context,"not(false())", Boolean.TRUE);
  -        assertXPathValue(context,"not(true())", Boolean.FALSE);
  -        assertXPathValue(context,"number('1')", new Double(1));
  -        assertXPathValue(context,"floor(1.5)", new Double(1));
  -        assertXPathValue(context,"floor(-1.5)", new Double(-2));
  -        assertXPathValue(context,"ceiling(1.5)", new Double(2));
  -        assertXPathValue(context,"ceiling(-1.5)", new Double(-1));
  -        assertXPathValue(context,"round(1.5)", new Double(2));
  -        assertXPathValue(context,"round(-1.5)", new Double(-1));
  -        assertXPathValue(context,"null()", null);
  +    public void testCoreFunctions() {
  +        assertXPathValue(context, "string(2)", "2");
  +        assertXPathValue(context, "string($nan)", "NaN");
  +        assertXPathValue(context, "string(-$nan)", "NaN");
  +        assertXPathValue(context, "string(-2 div 0)", "-Infinity");
  +        assertXPathValue(context, "string(2 div 0)", "Infinity");
  +        assertXPathValue(context, "concat('a', 'b', 'c')", "abc");
  +        assertXPathValue(context, "starts-with('abc', 'ab')", Boolean.TRUE);
  +        assertXPathValue(context, "starts-with('xabc', 'ab')", Boolean.FALSE);
  +        assertXPathValue(context, "contains('xabc', 'ab')", Boolean.TRUE);
  +        assertXPathValue(context, "contains('xabc', 'ba')", Boolean.FALSE);
  +        assertXPathValue(
  +            context,
  +            "substring-before('1999/04/01', '/')",
  +            "1999");
  +        assertXPathValue(
  +            context,
  +            "substring-after('1999/04/01', '/')",
  +            "04/01");
  +        assertXPathValue(context, "substring('12345', 2, 3)", "234");
  +        assertXPathValue(context, "substring('12345', 2)", "2345");
  +        assertXPathValue(context, "substring('12345', 1.5, 2.6)", "234");
  +        assertXPathValue(context, "substring('12345', 0, 3)", "12");
  +        assertXPathValue(context, "substring('12345', 0 div 0, 3)", "");
  +        assertXPathValue(context, "substring('12345', 1, 0 div 0)", "");
  +        assertXPathValue(context, "substring('12345', -42, 1 div 0)", "12345");
  +        assertXPathValue(context, "substring('12345', -1 div 0, 1 div 0)", "");
  +        assertXPathValue(context, "string-length('12345')", new Double(5));
  +        assertXPathValue(context, "normalize-space(' abc  def  ')", "abc def");
  +        assertXPathValue(context, "normalize-space('abc def')", "abc def");
  +        assertXPathValue(context, "normalize-space('   ')", "");
  +        assertXPathValue(context, "translate('--aaa--', 'abc-', 'ABC')", "AAA");
  +        assertXPathValue(context, "boolean(1)", Boolean.TRUE);
  +        assertXPathValue(context, "boolean(0)", Boolean.FALSE);
  +        assertXPathValue(context, "boolean('x')", Boolean.TRUE);
  +        assertXPathValue(context, "boolean('')", Boolean.FALSE);
  +
  +        assertXPathValue(context, "true()", Boolean.TRUE);
  +        assertXPathValue(context, "false()", Boolean.FALSE);
  +        assertXPathValue(context, "not(false())", Boolean.TRUE);
  +        assertXPathValue(context, "not(true())", Boolean.FALSE);
  +        assertXPathValue(context, "number('1')", new Double(1));
  +        assertXPathValue(context, "floor(1.5)", new Double(1));
  +        assertXPathValue(context, "floor(-1.5)", new Double(-2));
  +        assertXPathValue(context, "ceiling(1.5)", new Double(2));
  +        assertXPathValue(context, "ceiling(-1.5)", new Double(-1));
  +        assertXPathValue(context, "round(1.5)", new Double(2));
  +        assertXPathValue(context, "round(-1.5)", new Double(-1));
  +        assertXPathValue(context, "null()", null);
       }
   
  -    public void testIDFunction(){
  -        context.setIdentityManager(new IdentityManager(){
  -            public Pointer getPointerByID(JXPathContext context, String id){
  -                NodePointer ptr = (NodePointer)context.
  -                        getPointer("/document");
  +    public void testIDFunction() {
  +        context.setIdentityManager(new IdentityManager() {
  +            public Pointer getPointerByID(JXPathContext context, String id) {
  +                NodePointer ptr = (NodePointer) context.getPointer("/document");
                   ptr = ptr.getValuePointer();
                   return ptr.getPointerByID(context, id);
               }
           });
   
  -        assertXPathValueAndPointer(context,
  -                "id(101)//street",
  -                "Tangerine Drive",
  -                "id('101')/address[1]/street[1]");
  -
  -        assertXPathPointerLenient(context,
  -                "id(105)/address/street",
  -                "id(105)/address/street");
  +        assertXPathValueAndPointer(
  +            context,
  +            "id(101)//street",
  +            "Tangerine Drive",
  +            "id('101')/address[1]/street[1]");
  +
  +        assertXPathPointerLenient(
  +            context,
  +            "id(105)/address/street",
  +            "id(105)/address/street");
       }
  -    
  -    public void testKeyFunction(){
  -        context.setKeyManager(new KeyManager(){
  -            public Pointer getPointerByKey(JXPathContext context,
  -                                            String key, String value){
  +
  +    public void testKeyFunction() {
  +        context.setKeyManager(new KeyManager() {
  +            public Pointer getPointerByKey(
  +                JXPathContext context,
  +                String key,
  +                String value) 
  +            {
                   return NodePointer.newNodePointer(null, "42", null);
               }
           });
  -        
  -        assertEquals("Test key", "42",
  -            context.getValue("key('a', 'b')"));
  +
  +        assertEquals("Test key", "42", context.getValue("key('a', 'b')"));
       }
   }
  
  
  
  1.2       +43 -56    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/CoreOperationTest.java
  
  Index: CoreOperationTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/CoreOperationTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CoreOperationTest.java	20 Oct 2002 03:48:22 -0000	1.1
  +++ CoreOperationTest.java	20 Jan 2003 00:00:27 -0000	1.2
  @@ -74,8 +74,7 @@
    * @version $Revision$ $Date$
    */
   
  -public class CoreOperationTest extends JXPathTestCase
  -{
  +public class CoreOperationTest extends JXPathTestCase {
       private JXPathContext context;
   
       /**
  @@ -83,74 +82,62 @@
        *
        * @param name Name of the test case
        */
  -    public CoreOperationTest(String name){
  +    public CoreOperationTest(String name) {
           super(name);
       }
   
  -    public void setUp(){
  -        if (context == null){
  +    public void setUp() {
  +        if (context == null) {
               context = JXPathContext.newContext(null);
               Variables vars = context.getVariables();
               vars.declareVariable("integer", new Integer(1));
           }
       }
   
  -    public void testInfoSetTypes(){
  +    public void testInfoSetTypes() {
   
           // Numbers
  -        assertXPathValue(context, "1",  new Double(1.0));
  +        assertXPathValue(context, "1", new Double(1.0));
           assertXPathPointer(context, "1", "1");
  -        assertXPathValueIterator(context,"1", list(new Double(1.0)));
  +        assertXPathValueIterator(context, "1", list(new Double(1.0)));
   
           assertXPathPointerIterator(context, "1", list("1"));
   
  -        assertXPathValue(context,"-1", new Double(-1.0));
  -        assertXPathValue(context,"2 + 2", new Double(4.0));
  -        assertXPathValue(context,"3 - 2", new Double(1.0));
  -        assertXPathValue(context,"1 + 2 + 3 - 4 + 5", new Double(7.0));
  -        assertXPathValue(context,"3 * 2", new Double(3.0*2.0));
  -        assertXPathValue(context,"3 div 2", new Double(3.0/2.0));
  -        assertXPathValue(context,"5 mod 2", new Double(1.0));
  +        assertXPathValue(context, "-1", new Double(-1.0));
  +        assertXPathValue(context, "2 + 2", new Double(4.0));
  +        assertXPathValue(context, "3 - 2", new Double(1.0));
  +        assertXPathValue(context, "1 + 2 + 3 - 4 + 5", new Double(7.0));
  +        assertXPathValue(context, "3 * 2", new Double(3.0 * 2.0));
  +        assertXPathValue(context, "3 div 2", new Double(3.0 / 2.0));
  +        assertXPathValue(context, "5 mod 2", new Double(1.0));
   
           // This test produces a different result with Xalan?
  -        assertXPathValue(context,"5.9 mod 2.1", new Double(1.0));
  +        assertXPathValue(context, "5.9 mod 2.1", new Double(1.0));
   
  -        assertXPathValue(context,"5 mod -2", new Double(1.0));
  -        assertXPathValue(context,"-5 mod 2", new Double(-1.0));
  -        assertXPathValue(context,"-5 mod -2", new Double(-1.0));
  -        assertXPathValue(context,"1 < 2", Boolean.TRUE);
  -        assertXPathValue(context,"1 > 2", Boolean.FALSE);
  -        assertXPathValue(context,"1 <= 1", Boolean.TRUE);
  -        assertXPathValue(context,"1 >= 2", Boolean.FALSE);
  -        assertXPathValue(context,"3 > 2 > 1", Boolean.FALSE);
  -        assertXPathValue(context,"3 > 2 and 2 > 1", Boolean.TRUE);
  -        assertXPathValue(context,"3 > 2 and 2 < 1", Boolean.FALSE);
  -        assertXPathValue(context,"3 < 2 or 2 > 1", Boolean.TRUE);
  -        assertXPathValue(context,"3 < 2 or 2 < 1", Boolean.FALSE);
  -        assertXPathValue(context,"1 = 1", Boolean.TRUE);
  -        assertXPathValue(context,"1 = '1'", Boolean.TRUE);
  -        assertXPathValue(context,"1 > 2 = 2 > 3", Boolean.TRUE);
  -        assertXPathValue(context,"1 > 2 = 0", Boolean.TRUE);
  -        assertXPathValue(context,"1 = 2", Boolean.FALSE);
  -
  -        assertXPathValue(context, 
  -                "$integer",
  -                new Double(1), 
  -                Double.class);
  -                
  -        assertXPathValue(context, 
  -                "2 + 3",
  -                "5.0",
  -                String.class);
  -                
  -        assertXPathValue(context, 
  -                "2 + 3",
  -                Boolean.TRUE, 
  -                boolean.class);
  -                
  -        assertXPathValue(context, 
  -                "'true'",
  -                Boolean.TRUE, 
  -                Boolean.class);
  +        assertXPathValue(context, "5 mod -2", new Double(1.0));
  +        assertXPathValue(context, "-5 mod 2", new Double(-1.0));
  +        assertXPathValue(context, "-5 mod -2", new Double(-1.0));
  +        assertXPathValue(context, "1 < 2", Boolean.TRUE);
  +        assertXPathValue(context, "1 > 2", Boolean.FALSE);
  +        assertXPathValue(context, "1 <= 1", Boolean.TRUE);
  +        assertXPathValue(context, "1 >= 2", Boolean.FALSE);
  +        assertXPathValue(context, "3 > 2 > 1", Boolean.FALSE);
  +        assertXPathValue(context, "3 > 2 and 2 > 1", Boolean.TRUE);
  +        assertXPathValue(context, "3 > 2 and 2 < 1", Boolean.FALSE);
  +        assertXPathValue(context, "3 < 2 or 2 > 1", Boolean.TRUE);
  +        assertXPathValue(context, "3 < 2 or 2 < 1", Boolean.FALSE);
  +        assertXPathValue(context, "1 = 1", Boolean.TRUE);
  +        assertXPathValue(context, "1 = '1'", Boolean.TRUE);
  +        assertXPathValue(context, "1 > 2 = 2 > 3", Boolean.TRUE);
  +        assertXPathValue(context, "1 > 2 = 0", Boolean.TRUE);
  +        assertXPathValue(context, "1 = 2", Boolean.FALSE);
  +
  +        assertXPathValue(context, "$integer", new Double(1), Double.class);
  +
  +        assertXPathValue(context, "2 + 3", "5.0", String.class);
  +
  +        assertXPathValue(context, "2 + 3", Boolean.TRUE, boolean.class);
  +
  +        assertXPathValue(context, "'true'", Boolean.TRUE, Boolean.class);
       }
   }
  
  
  
  1.4       +154 -154  jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/ExtensionFunctionTest.java
  
  Index: ExtensionFunctionTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/ExtensionFunctionTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ExtensionFunctionTest.java	26 Nov 2002 01:33:34 -0000	1.3
  +++ ExtensionFunctionTest.java	20 Jan 2003 00:00:27 -0000	1.4
  @@ -85,8 +85,7 @@
    * @version $Revision$ $Date$
    */
   
  -public class ExtensionFunctionTest extends JXPathTestCase
  -{
  +public class ExtensionFunctionTest extends JXPathTestCase {
       private Functions functions;
       private JXPathContext context;
   
  @@ -95,219 +94,220 @@
        *
        * @param name Name of the test case
        */
  -    public ExtensionFunctionTest(String name){
  +    public ExtensionFunctionTest(String name) {
           super(name);
       }
   
  -    public void setUp(){
  -        if (context == null){
  +    public void setUp() {
  +        if (context == null) {
               context = JXPathContext.newContext(new TestBean());
               Variables vars = context.getVariables();
               vars.declareVariable("test", new TestFunctions(4, "test"));
  -           
  +
               FunctionLibrary lib = new FunctionLibrary();
               lib.addFunctions(new ClassFunctions(TestFunctions.class, "test"));
               lib.addFunctions(new ClassFunctions(TestFunctions2.class, "test"));
               lib.addFunctions(new PackageFunctions("", "call"));
               lib.addFunctions(
  -                    new PackageFunctions(
  -                            "org.apache.commons.jxpath.ri.compiler.", 
  -                            "jxpathtest"));
  +                new PackageFunctions(
  +                    "org.apache.commons.jxpath.ri.compiler.",
  +                    "jxpathtest"));
               context.setFunctions(lib);
           }
           functions = new ClassFunctions(TestFunctions.class, "test");
       }
  -    
  -    public void testConstructorLookup(){
  -        Object[] args = new Object[]{new Integer(1), "x"};
  +
  +    public void testConstructorLookup() {
  +        Object[] args = new Object[] { new Integer(1), "x" };
  +        Function func = functions.getFunction("test", "new", args);
  +
  +        assertEquals(
  +            "test:new(1, x)",
  +            func.invoke(new Context(null), args).toString(),
  +            "foo=1; bar=x");
  +    }
  +
  +    public void testConstructorLookupWithExpressionContext() {
  +        Object[] args = new Object[] { "baz" };
           Function func = functions.getFunction("test", "new", args);
  -        
  -        assertEquals("test:new(1, x)", 
  -            func.invoke(new Context(null), args).toString(), 
  +        assertEquals(
  +            "test:new('baz')",
  +            func.invoke(new Context(new Integer(1)), args).toString(),
  +            "foo=1; bar=baz");
  +    }
  +
  +    public void testStaticMethodLookup() {
  +        Object[] args = new Object[] { new Integer(1), "x" };
  +        Function func = functions.getFunction("test", "build", args);
  +        assertEquals(
  +            "test:build(1, x)",
  +            func.invoke(new Context(null), args).toString(),
               "foo=1; bar=x");
       }
  -    
  -    public void testConstructorLookupWithExpressionContext(){
  -        Object[] args = new Object[]{"baz"};
  -        Function func =functions.getFunction("test", "new", args);
  -        assertEquals("test:new('baz')", 
  -                func.invoke(new Context(new Integer(1)), args).toString(), 
  -                "foo=1; bar=baz");
  -    }
  -    
  -    public void testStaticMethodLookup(){
  -        Object[] args = new Object[]{new Integer(1), "x"};
  -        Function func =functions.getFunction("test", "build", args);
  -        assertEquals("test:build(1, x)", 
  -                func.invoke(new Context(null), args).toString(), 
  -                "foo=1; bar=x");
  -    }
  -    
  -    public void testStaticMethodLookupWithConversion(){
  -        Object[] args = new Object[]{"7", new Integer(1)};
  -        Function func =functions.getFunction("test", "build", args);
  -        assertEquals("test:build('7', 1)", 
  -                func.invoke(new Context(null), args).toString(), 
  -                "foo=7; bar=1");
  -    }
  -    
  -    public void testMethodLookup(){
  -        Object[] args = new Object[]{new TestFunctions()};
  -        Function func =functions.getFunction("test", "getFoo", args);
  -        assertEquals("test:getFoo($test, 1, x)", 
  -                func.invoke(new Context(null), args).toString(), 
  -                "0");
  +
  +    public void testStaticMethodLookupWithConversion() {
  +        Object[] args = new Object[] { "7", new Integer(1)};
  +        Function func = functions.getFunction("test", "build", args);
  +        assertEquals(
  +            "test:build('7', 1)",
  +            func.invoke(new Context(null), args).toString(),
  +            "foo=7; bar=1");
  +    }
  +
  +    public void testMethodLookup() {
  +        Object[] args = new Object[] { new TestFunctions()};
  +        Function func = functions.getFunction("test", "getFoo", args);
  +        assertEquals(
  +            "test:getFoo($test, 1, x)",
  +            func.invoke(new Context(null), args).toString(),
  +            "0");
       }
  -    
  -    public void testStaticMethodLookupWithExpressionContext(){
  +
  +    public void testStaticMethodLookupWithExpressionContext() {
           Object[] args = new Object[0];
  -        Function func =functions.getFunction("test", "path", args);
  -        assertEquals("test:path()", 
  -                func.invoke(new Context(new Integer(1)), args), 
  -                "1");
  -    }
  -    
  -    public void testMethodLookupWithExpressionContext(){
  -        Object[] args = new Object[]{new TestFunctions()};
  -        Function func =functions.getFunction("test", "instancePath", args);
  -        assertEquals("test:instancePath()", 
  -                func.invoke(new Context(new Integer(1)), args), 
  -                "1");
  -    }
  -    
  -    public void testMethodLookupWithExpressionContextAndArgument(){
  -        Object[] args = new Object[]{new TestFunctions(), "*"};
  -        Function func =functions.getFunction("test", "pathWithSuffix", args);
  -        assertEquals("test:pathWithSuffix('*')", 
  -                func.invoke(new Context(new Integer(1)), args), 
  -                "1*");
  -    }    
  +        Function func = functions.getFunction("test", "path", args);
  +        assertEquals(
  +            "test:path()",
  +            func.invoke(new Context(new Integer(1)), args),
  +            "1");
  +    }
  +
  +    public void testMethodLookupWithExpressionContext() {
  +        Object[] args = new Object[] { new TestFunctions()};
  +        Function func = functions.getFunction("test", "instancePath", args);
  +        assertEquals(
  +            "test:instancePath()",
  +            func.invoke(new Context(new Integer(1)), args),
  +            "1");
  +    }
  +
  +    public void testMethodLookupWithExpressionContextAndArgument() {
  +        Object[] args = new Object[] { new TestFunctions(), "*" };
  +        Function func = functions.getFunction("test", "pathWithSuffix", args);
  +        assertEquals(
  +            "test:pathWithSuffix('*')",
  +            func.invoke(new Context(new Integer(1)), args),
  +            "1*");
  +    }
  +
  +    public void testAllocation() {
   
  -    public void testAllocation(){ 
  -        
           // Allocate new object using the default constructor
  -        assertXPathValue(context, 
  -                "string(test:new())", 
  -                "foo=0; bar=null");
  -                
  +        assertXPathValue(context, "string(test:new())", "foo=0; bar=null");
  +
           // Allocate new object using PackageFunctions and class name
  -        assertXPathValue(context, 
  -                "string(jxpathtest:TestFunctions.new())", 
  -                "foo=0; bar=null");
  -                
  +        assertXPathValue(
  +            context,
  +            "string(jxpathtest:TestFunctions.new())",
  +            "foo=0; bar=null");
  +
           // Allocate new object using a fully qualified class name
  -        assertXPathValue(context, 
  -                "string(" + TestFunctions.class.getName() + ".new())", 
  -                "foo=0; bar=null");
  -                
  +        assertXPathValue(
  +            context,
  +            "string(" + TestFunctions.class.getName() + ".new())",
  +            "foo=0; bar=null");
  +
           // Allocate new object using a custom constructor
  -        assertXPathValue(context, 
  -                "string(test:new(3, 'baz'))", 
  -                "foo=3; bar=baz");
  -                
  +        assertXPathValue(
  +            context,
  +            "string(test:new(3, 'baz'))",
  +            "foo=3; bar=baz");
  +
           // Allocate new object using a custom constructor - type conversion
  -        assertXPathValue(context, 
  -                "string(test:new('3', 4))", 
  -                "foo=3; bar=4.0");                
  +        assertXPathValue(context, "string(test:new('3', 4))", "foo=3; bar=4.0");
       }
   
  -    public void testMethodCall(){ 
  -        assertXPathValue(context, 
  -                "length('foo')", 
  -                new Integer(3));
  -                
  +    public void testMethodCall() {
  +        assertXPathValue(context, "length('foo')", new Integer(3));
  +
           // We are just calling a method - prefix is ignored
  -        assertXPathValue(context, 
  -                "call:substring('foo', 1, 2)", 
  -                "o");
  -        
  +        assertXPathValue(context, "call:substring('foo', 1, 2)", "o");
  +
           // Invoke a function implemented as a regular method
  -        assertXPathValue(context, 
  -                "string(test:getFoo($test))", 
  -                "4");
  -        
  +        assertXPathValue(context, "string(test:getFoo($test))", "4");
  +
           // Note that the prefix is ignored anyway, we are just calling a method
  -        assertXPathValue(context, 
  -                "string(call:getFoo($test))", 
  -                "4");
  -        
  +        assertXPathValue(context, "string(call:getFoo($test))", "4");
  +
           // We don't really need to supply a prefix in this case
  -        assertXPathValue(context, 
  -                "string(getFoo($test))", 
  -                "4");                
  +        assertXPathValue(context, "string(getFoo($test))", "4");
   
           // Method with two arguments
  -        assertXPathValue(context, 
  -                "string(test:setFooAndBar($test, 7, 'biz'))", 
  -                "foo=7; bar=biz");
  +        assertXPathValue(
  +            context,
  +            "string(test:setFooAndBar($test, 7, 'biz'))",
  +            "foo=7; bar=biz");
       }
   
  -    public void testStaticMethodCall(){ 
  -                                
  -        assertXPathValue(context, 
  -                "string(test:build(8, 'goober'))", 
  -                "foo=8; bar=goober");
  -                
  +    public void testStaticMethodCall() {
  +
  +        assertXPathValue(
  +            context,
  +            "string(test:build(8, 'goober'))",
  +            "foo=8; bar=goober");
  +
           // Call a static method using PackageFunctions and class name
  -        assertXPathValue(context, 
  -                "string(jxpathtest:TestFunctions.build(8, 'goober'))", 
  -                "foo=8; bar=goober");
  -        
  +        assertXPathValue(
  +            context,
  +            "string(jxpathtest:TestFunctions.build(8, 'goober'))",
  +            "foo=8; bar=goober");
  +
           // Call a static method with a fully qualified class name
  -        assertXPathValue(context, 
  -                "string(" + TestFunctions.class.getName() + 
  -                        ".build(8, 'goober'))", 
  -                "foo=8; bar=goober");
  -                
  +        assertXPathValue(
  +            context,
  +            "string(" + TestFunctions.class.getName() + ".build(8, 'goober'))",
  +            "foo=8; bar=goober");
  +
           // Two ClassFunctions are sharing the same prefix.
           // This is TestFunctions2
  -        assertXPathValue(context, 
  -                "string(test:increment(8))", 
  -                "9");
  -                
  +        assertXPathValue(context, "string(test:increment(8))", "9");
  +
       }
   
  -    public void testExpressionContext(){ 
  +    public void testExpressionContext() {
           // Execute an extension function for each node while searching
           // The function uses ExpressionContext to get to the current
           // node.
  -        assertXPathValue(context, 
  -                "//.[test:isMap()]/Key1", 
  -                "Value 1");
  -                
  +        assertXPathValue(context, "//.[test:isMap()]/Key1", "Value 1");
  +
           // The function uses ExpressionContext to get to all
           // nodes in the context that is passed to it.
  -        assertXPathValue(context, 
  -                "count(//.[test:count(strings) = 3])", 
  -                new Double(7));
  +        assertXPathValue(
  +            context,
  +            "count(//.[test:count(strings) = 3])",
  +            new Double(7));
   
           // The function uses ExpressionContext to get to the current
           // pointer and returns its path.
  -        assertXPathValue(context, 
  -                "/beans[contains(test:path(), '[2]')]/name", 
  -                "Name 2");
  +        assertXPathValue(
  +            context,
  +            "/beans[contains(test:path(), '[2]')]/name",
  +            "Name 2");
       }
  -    
  +
       private static class Context implements ExpressionContext {
           private Object object;
   
  -        public Context(Object object){
  +        public Context(Object object) {
               this.object = object;
           }
   
  -        public Pointer getContextNodePointer(){
  -            return NodePointer.newNodePointer(null, object, Locale.getDefault());
  +        public Pointer getContextNodePointer() {
  +            return NodePointer.newNodePointer(
  +                null,
  +                object,
  +                Locale.getDefault());
           }
   
  -        public List getContextNodeList(){
  +        public List getContextNodeList() {
               return null;
           }
   
  -        public JXPathContext getJXPathContext(){
  +        public JXPathContext getJXPathContext() {
               return null;
           }
   
  -        public int getPosition(){
  +        public int getPosition() {
               return 0;
           }
       }
  
  
  
  1.3       +24 -21    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/TestFunctions.java
  
  Index: TestFunctions.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/TestFunctions.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestFunctions.java	26 Nov 2002 01:33:34 -0000	1.2
  +++ TestFunctions.java	20 Jan 2003 00:00:27 -0000	1.3
  @@ -76,65 +76,68 @@
       private int foo;
       private String bar;
   
  -    public TestFunctions(){
  +    public TestFunctions() {
       }
   
  -    public TestFunctions(int foo, String bar){
  +    public TestFunctions(int foo, String bar) {
           this.foo = foo;
           this.bar = bar;
       }
   
  -    public TestFunctions(ExpressionContext context, String bar){
  -        this.foo = ((Number)context.getContextNodePointer().getValue()).
  -                intValue();
  +    public TestFunctions(ExpressionContext context, String bar) {
  +        this.foo =
  +            ((Number) context.getContextNodePointer().getValue()).intValue();
           this.bar = bar;
       }
   
  -    public int getFoo(){
  +    public int getFoo() {
           return foo;
       }
   
  -    public String getBar(){
  +    public String getBar() {
           return bar;
       }
   
  -    public void doit(){
  +    public void doit() {
       }
   
  -    public TestFunctions setFooAndBar(int foo, String bar){
  +    public TestFunctions setFooAndBar(int foo, String bar) {
           this.foo = foo;
           this.bar = bar;
           return this;
       }
   
  -    public static TestFunctions build(int foo, String bar){
  +    public static TestFunctions build(int foo, String bar) {
           return new TestFunctions(foo, bar);
       }
   
  -    public String toString(){
  +    public String toString() {
           return "foo=" + foo + "; bar=" + bar;
       }
   
  -    public static String path(ExpressionContext context){
  +    public static String path(ExpressionContext context) {
           return context.getContextNodePointer().asPath();
       }
   
  -    public String instancePath(ExpressionContext context){
  +    public String instancePath(ExpressionContext context) {
           return context.getContextNodePointer().asPath();
       }
   
  -    public String pathWithSuffix(ExpressionContext context, String suffix){
  +    public String pathWithSuffix(ExpressionContext context, String suffix) {
           return context.getContextNodePointer().asPath() + suffix;
       }
   
  -    public String className(ExpressionContext context, ExpressionContext child){
  +    public String className(
  +        ExpressionContext context,
  +        ExpressionContext child) 
  +    {
           return context.getContextNodePointer().asPath();
       }
   
       /**
        * Returns true if the current node in the current context is a map
        */
  -    public static boolean isMap(ExpressionContext context){
  +    public static boolean isMap(ExpressionContext context) {
           Pointer ptr = context.getContextNodePointer();
           return ptr == null ? false : (ptr.getValue() instanceof Map);
       }
  @@ -143,7 +146,7 @@
        * Returns the number of nodes in the context that is passed as
        * the first argument.
        */
  -    public static int count(ExpressionContext context, Collection col){
  +    public static int count(ExpressionContext context, Collection col) {
           return col.size();
       }
   }
  
  
  
  1.3       +5 -5      jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/TestFunctions2.java
  
  Index: TestFunctions2.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/TestFunctions2.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestFunctions2.java	26 Nov 2002 01:20:08 -0000	1.2
  +++ TestFunctions2.java	20 Jan 2003 00:00:27 -0000	1.3
  @@ -68,7 +68,7 @@
    */
   public class TestFunctions2 {
   
  -    public static int increment(int i){
  +    public static int increment(int i) {
           return i + 1;
       }
   }
  
  
  
  1.2       +25 -17    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/VariableFactory.java
  
  Index: VariableFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/VariableFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VariableFactory.java	20 Oct 2002 03:48:22 -0000	1.1
  +++ VariableFactory.java	20 Jan 2003 00:00:27 -0000	1.2
  @@ -77,36 +77,44 @@
   
       /**
        */
  -    public boolean createObject(JXPathContext context, Pointer pointer, Object parent, String name, int index){
  -        if (name.equals("testArray")){
  -            ((TestBean[])parent)[index] = new TestBean();
  +    public boolean createObject(
  +        JXPathContext context,
  +        Pointer pointer,
  +        Object parent,
  +        String name,
  +        int index) 
  +    {
  +        if (name.equals("testArray")) {
  +            ((TestBean[]) parent)[index] = new TestBean();
               return true;
           }
  -        else if (name.equals("stringArray")){
  -            ((String[])parent)[index] = "";
  +        else if (name.equals("stringArray")) {
  +            ((String[]) parent)[index] = "";
               return true;
           }
  -        else if (name.equals("array")){
  -            ((String[])parent)[index] = "";
  +        else if (name.equals("array")) {
  +            ((String[]) parent)[index] = "";
               return true;
           }
           return false;
       }
  -    
  +
       /**
        * Create a new object and set it on the specified variable
        */
  -    public boolean declareVariable(JXPathContext context, String name){
  -        if (name.equals("test")){
  +    public boolean declareVariable(JXPathContext context, String name) {
  +        if (name.equals("test")) {
               context.getVariables().declareVariable(name, new TestBean());
               return true;
           }
  -        else if (name.equals("testArray")){
  +        else if (name.equals("testArray")) {
               context.getVariables().declareVariable(name, new TestBean[0]);
               return true;
           }
  -        else if (name.equals("stringArray")){
  -            context.getVariables().declareVariable(name, new String[]{"Value1"});
  +        else if (name.equals("stringArray")) {
  +            context.getVariables().declareVariable(
  +                name,
  +                new String[] { "Value1" });
               return true;
           }
           context.getVariables().declareVariable(name, null);
  
  
  
  1.2       +143 -147  jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/VariableTest.java
  
  Index: VariableTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/VariableTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- VariableTest.java	20 Oct 2002 03:48:22 -0000	1.1
  +++ VariableTest.java	20 Jan 2003 00:00:27 -0000	1.2
  @@ -74,8 +74,7 @@
    * @version $Revision$ $Date$
    */
   
  -public class VariableTest extends JXPathTestCase
  -{
  +public class VariableTest extends JXPathTestCase {
       private JXPathContext context;
   
       /**
  @@ -83,237 +82,234 @@
        *
        * @param name Name of the test case
        */
  -    public VariableTest(String name){
  +    public VariableTest(String name) {
           super(name);
       }
   
  -    public void setUp(){
  -        if (context == null){
  +    public void setUp() {
  +        if (context == null) {
               context = JXPathContext.newContext(null);
               context.setFactory(new VariableFactory());
  -        
  +
               Variables vars = context.getVariables();
               vars.declareVariable("a", new Double(1));
               vars.declareVariable("b", new Double(1));
  -            vars.declareVariable("c", null);            
  -            vars.declareVariable("d", new String[]{"a", "b"});
  +            vars.declareVariable("c", null);
  +            vars.declareVariable("d", new String[] { "a", "b" });
               vars.declareVariable("integer", new Integer(1));
               vars.declareVariable("nan", new Double(Double.NaN));
               vars.declareVariable("x", null);
           }
       }
   
  -    public void testVariables(){
  +    public void testVariables() {
           // Variables
  -        assertXPathValueAndPointer(context,
  -                "$a", 
  -                new Double(1),
  -                "$a");
  -    }
  -    
  -    public void testVariablesInExpressions(){
  -        assertXPathValue(context,
  -                "$a = $b", 
  -                Boolean.TRUE);
  -                
  -        assertXPathValue(context,
  -                "$a = $nan", 
  -                Boolean.FALSE);
  -
  -        assertXPathValue(context,
  -                "$a + 1", 
  -                new Double(2));
  -
  -        assertXPathValue(context,
  -                "$c", 
  -                null);
  -                
  -        assertXPathValue(context, 
  -                "$d[2]",  
  -                "b");
  +        assertXPathValueAndPointer(context, "$a", new Double(1), "$a");
       }
  -    
  -    public void testInvalidVariableName(){                
  +
  +    public void testVariablesInExpressions() {
  +        assertXPathValue(context, "$a = $b", Boolean.TRUE);
  +
  +        assertXPathValue(context, "$a = $nan", Boolean.FALSE);
  +
  +        assertXPathValue(context, "$a + 1", new Double(2));
  +
  +        assertXPathValue(context, "$c", null);
  +
  +        assertXPathValue(context, "$d[2]", "b");
  +    }
  +
  +    public void testInvalidVariableName() {
           boolean exception = false;
           try {
               context.getValue("$none");
           }
  -        catch (Exception ex){
  +        catch (Exception ex) {
               exception = true;
           }
  -        assertTrue("Evaluating '$none', expected exception - did not get it", 
  -                exception);
  +        assertTrue(
  +            "Evaluating '$none', expected exception - did not get it",
  +            exception);
   
           exception = false;
           try {
               context.setValue("$none", new Integer(1));
           }
  -        catch (Exception ex){
  +        catch (Exception ex) {
               exception = true;
           }
  -        assertTrue("Setting '$none = 1', expected exception - did not get it", 
  +        assertTrue(
  +            "Setting '$none = 1', expected exception - did not get it",
               exception);
       }
  -    
  -    public void testNestedContext(){
  -        JXPathContext nestedContext = 
  -                JXPathContext.newContext(context, null);
  -
  -        assertXPathValue(nestedContext, 
  -                "$a",  
  -                new Double(1));
  -    }    
  -    
  -    public void testSetValue(){        
  -        assertXPathSetValue(context, 
  -                "$x",
  -                new Integer(1));
  +
  +    public void testNestedContext() {
  +        JXPathContext nestedContext = JXPathContext.newContext(context, null);
  +
  +        assertXPathValue(nestedContext, "$a", new Double(1));
  +    }
  +
  +    public void testSetValue() {
  +        assertXPathSetValue(context, "$x", new Integer(1));
       }
  -    
  -    public void testCreatePathDeclareVariable(){
  +
  +    public void testCreatePathDeclareVariable() {
           // Calls factory.declareVariable("string")
  -        assertXPathCreatePath(context, 
  -                "$string", 
  -                null,
  -                "$string");
  +        assertXPathCreatePath(context, "$string", null, "$string");
       }
  -    
  -    public void testCreatePathAndSetValueDeclareVariable(){
  +
  +    public void testCreatePathAndSetValueDeclareVariable() {
           // Calls factory.declareVariable("string")
  -        assertXPathCreatePathAndSetValue(context, 
  -                "$string", 
  -                "Value",
  -                "$string");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "$string",
  +            "Value",
  +            "$string");
       }
  -    
  -    public void testCreatePathDeclareVariableSetCollectionElement(){
  +
  +    public void testCreatePathDeclareVariableSetCollectionElement() {
           // Calls factory.declareVariable("stringArray"). 
           // The factory needs to create a collection
  -        assertXPathCreatePath(context, 
  -                "$stringArray[2]", 
  -                "",
  -                "$stringArray[2]");
  -        
  +        assertXPathCreatePath(
  +            context,
  +            "$stringArray[2]",
  +            "",
  +            "$stringArray[2]");
  +
           // See if the factory populated the first element as well
  -        assertEquals("Created <" + "$stringArray[1]" + ">", 
  -                "Value1", 
  -                context.getValue("$stringArray[1]"));
  +        assertEquals(
  +            "Created <" + "$stringArray[1]" + ">",
  +            "Value1",
  +            context.getValue("$stringArray[1]"));
       }
   
  -    public void testCreateAndSetValuePathDeclareVariableSetCollectionElement(){
  +    public void testCreateAndSetValuePathDeclareVariableSetCollectionElement() {
           // Calls factory.declareVariable("stringArray"). 
           // The factory needs to create a collection
  -        assertXPathCreatePathAndSetValue(context, 
  -                "$stringArray[2]", 
  -                "Value2",
  -                "$stringArray[2]");
  -        
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "$stringArray[2]",
  +            "Value2",
  +            "$stringArray[2]");
  +
           // See if the factory populated the first element as well
  -        assertEquals("Created <" + "$stringArray[1]" + ">", 
  -                "Value1", 
  -                context.getValue("$stringArray[1]"));
  +        assertEquals(
  +            "Created <" + "$stringArray[1]" + ">",
  +            "Value1",
  +            context.getValue("$stringArray[1]"));
       }
   
  -    public void testCreatePathExpandCollection(){
  -        context.getVariables().
  -            declareVariable("array", new String[]{"Value1"});
  +    public void testCreatePathExpandCollection() {
  +        context.getVariables().declareVariable(
  +            "array",
  +            new String[] { "Value1" });
   
           // Does not involve factory at all - just expands the collection
  -        assertXPathCreatePath(context, 
  -                "$array[2]", 
  -                "", 
  -                "$array[2]");
  +        assertXPathCreatePath(context, "$array[2]", "", "$array[2]");
   
           // Make sure it is still the same array
  -        assertEquals("Created <" + "$array[1]" + ">", 
  -                "Value1", 
  -                context.getValue("$array[1]"));
  +        assertEquals(
  +            "Created <" + "$array[1]" + ">",
  +            "Value1",
  +            context.getValue("$array[1]"));
       }
   
  -    public void testCreatePathAndSetValueExpandCollection(){
  -        context.getVariables().
  -            declareVariable("array", new String[]{"Value1"});
  +    public void testCreatePathAndSetValueExpandCollection() {
  +        context.getVariables().declareVariable(
  +            "array",
  +            new String[] { "Value1" });
   
           // Does not involve factory at all - just expands the collection
  -        assertXPathCreatePathAndSetValue(context, 
  -                "$array[2]", 
  -                "Value2", 
  -                "$array[2]");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "$array[2]",
  +            "Value2",
  +            "$array[2]");
   
           // Make sure it is still the same array
  -        assertEquals("Created <" + "$array[1]" + ">", 
  -                "Value1", 
  -                context.getValue("$array[1]"));
  +        assertEquals(
  +            "Created <" + "$array[1]" + ">",
  +            "Value1",
  +            context.getValue("$array[1]"));
       }
   
  -    public void testCreatePathDeclareVariableSetProperty(){
  +    public void testCreatePathDeclareVariableSetProperty() {
           // Calls factory.declareVariable("test"). 
           // The factory should create a TestBean
  -        assertXPathCreatePath(context, 
  -                "$test/boolean", 
  -                Boolean.FALSE, 
  -                "$test/boolean");
  +        assertXPathCreatePath(
  +            context,
  +            "$test/boolean",
  +            Boolean.FALSE,
  +            "$test/boolean");
   
       }
   
  -    public void testCreatePathAndSetValueDeclareVariableSetProperty(){
  +    public void testCreatePathAndSetValueDeclareVariableSetProperty() {
           // Calls factory.declareVariable("test"). 
           // The factory should create a TestBean
  -        assertXPathCreatePathAndSetValue(context, 
  -                "$test/boolean", 
  -                Boolean.TRUE, 
  -                "$test/boolean");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "$test/boolean",
  +            Boolean.TRUE,
  +            "$test/boolean");
   
       }
   
  -    public void testCreatePathDeclareVariableSetCollectionElementProperty(){
  +    public void testCreatePathDeclareVariableSetCollectionElementProperty() {
           // Calls factory.declareVariable("testArray").
           // The factory should create a collection of TestBeans.
           // Then calls factory.createObject(..., collection, "testArray", 1).
           // That one should produce an instance of TestBean and 
           // put it in the collection at index 1.
  -        assertXPathCreatePath(context, 
  -                "$testArray[2]/boolean", 
  -                Boolean.FALSE, 
  -                "$testArray[2]/boolean");
  +        assertXPathCreatePath(
  +            context,
  +            "$testArray[2]/boolean",
  +            Boolean.FALSE,
  +            "$testArray[2]/boolean");
       }
  -    
  -    public void testCreatePathAndSetValueDeclVarSetCollectionElementProperty(){
  +
  +    public void testCreatePathAndSetValueDeclVarSetCollectionElementProperty() {
           // Calls factory.declareVariable("testArray").
           // The factory should create a collection of TestBeans.
           // Then calls factory.createObject(..., collection, "testArray", 1).
           // That one should produce an instance of TestBean and 
           // put it in the collection at index 1.
  -        assertXPathCreatePathAndSetValue(context, 
  -                "$testArray[2]/boolean", 
  -                Boolean.TRUE, 
  -                "$testArray[2]/boolean");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "$testArray[2]/boolean",
  +            Boolean.TRUE,
  +            "$testArray[2]/boolean");
       }
  -    
  -    public void testRemovePathUndeclareVariable(){
  +
  +    public void testRemovePathUndeclareVariable() {
           // Undeclare variable
           context.getVariables().declareVariable("temp", "temp");
           context.removePath("$temp");
  -        assertTrue("Undeclare variable",
  -                !context.getVariables().isDeclaredVariable("temp"));
  +        assertTrue(
  +            "Undeclare variable",
  +            !context.getVariables().isDeclaredVariable("temp"));
   
       }
  -    
  -    public void testRemovePathArrayElement(){
  +
  +    public void testRemovePathArrayElement() {
           // Remove array element - reassigns the new array to the var
  -        context.getVariables().
  -                declareVariable("temp", new String[]{"temp1", "temp2"});
  +        context.getVariables().declareVariable(
  +            "temp",
  +            new String[] { "temp1", "temp2" });
           context.removePath("$temp[1]");
  -        assertEquals("Remove array element", "temp2",
  -                    context.getValue("$temp[1]"));
  +        assertEquals(
  +            "Remove array element",
  +            "temp2",
  +            context.getValue("$temp[1]"));
       }
  -    
  -    public void testRemovePathCollectionElement(){
  +
  +    public void testRemovePathCollectionElement() {
           // Remove list element - does not create a new list
  -        context.getVariables().
  -                declareVariable("temp", list("temp1", "temp2"));
  +        context.getVariables().declareVariable("temp", list("temp1", "temp2"));
           context.removePath("$temp[1]");
  -        assertEquals("Remove collection element", "temp2",
  -                    context.getValue("$temp[1]"));
  +        assertEquals(
  +            "Remove collection element",
  +            "temp2",
  +            context.getValue("$temp[1]"));
       }
   }
  
  
  
  1.8       +466 -511  jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/BeanModelTestCase.java
  
  Index: BeanModelTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/BeanModelTestCase.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BeanModelTestCase.java	12 Jan 2003 01:52:57 -0000	1.7
  +++ BeanModelTestCase.java	20 Jan 2003 00:00:28 -0000	1.8
  @@ -62,9 +62,16 @@
   
   package org.apache.commons.jxpath.ri.model;
   
  -import java.util.*;
  -
  -import org.apache.commons.jxpath.*;
  +import java.util.ArrayList;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Locale;
  +
  +import org.apache.commons.jxpath.AbstractFactory;
  +import org.apache.commons.jxpath.JXPathContext;
  +import org.apache.commons.jxpath.JXPathTestCase;
  +import org.apache.commons.jxpath.NestedTestBean;
  +import org.apache.commons.jxpath.Pointer;
   import org.apache.commons.jxpath.ri.QName;
   import org.apache.commons.jxpath.ri.compiler.NodeNameTest;
   import org.apache.commons.jxpath.ri.model.beans.PropertyOwnerPointer;
  @@ -77,8 +84,7 @@
    * @version $Revision$ $Date$
    */
   
  -public abstract class BeanModelTestCase extends JXPathTestCase
  -{
  +public abstract class BeanModelTestCase extends JXPathTestCase {
       private JXPathContext context;
   
       /**
  @@ -86,12 +92,12 @@
        *
        * @param name Name of the test case
        */
  -    public BeanModelTestCase(String name){
  +    public BeanModelTestCase(String name) {
           super(name);
       }
   
  -    public void setUp(){
  -        if (context == null){
  +    public void setUp() {
  +        if (context == null) {
               context = JXPathContext.newContext(createContextBean());
               context.setLocale(Locale.US);
               context.setFactory(getAbstractFactory());
  @@ -104,7 +110,7 @@
       /**
        * Test property iterators, the core of the graph traversal engine
        */
  -    public void testIndividualIterators(){
  +    public void testIndividualIterators() {
           testIndividual(+1, 0, true, false, 0);
           testIndividual(-1, 0, true, false, 4);
   
  @@ -119,8 +125,12 @@
           testIndividual(0, 0, false, true, 4);
       }
   
  -    private void testIndividual(int relativePropertyIndex, int offset,
  -                boolean useStartLocation, boolean reverse, int expected)
  +    private void testIndividual(
  +        int relativePropertyIndex,
  +        int offset,
  +        boolean useStartLocation,
  +        boolean reverse,
  +        int expected) 
       {
           PropertyOwnerPointer root =
               (PropertyOwnerPointer) NodePointer.newNodePointer(
  @@ -164,7 +174,7 @@
       /**
        * Test property iterators with multiple properties returned
        */
  -    public void testMultipleIterators(){
  +    public void testMultipleIterators() {
           testMultiple(0, 0, true, false, 20);
   
           testMultiple(3, 0, true, false, 16);
  @@ -177,18 +187,23 @@
           testMultiple(3, 3, true, false, 13);
       }
   
  -    private void testMultiple(int propertyIndex, int offset,
  -                boolean useStartLocation, boolean reverse, int expected)
  +    private void testMultiple(
  +        int propertyIndex,
  +        int offset,
  +        boolean useStartLocation,
  +        boolean reverse,
  +        int expected) 
       {
           PropertyOwnerPointer root =
  -                (PropertyOwnerPointer)NodePointer.newNodePointer(
  -                        new QName(null, "root"), createContextBean(),
  -                        Locale.getDefault());
  +            (PropertyOwnerPointer) NodePointer.newNodePointer(
  +                new QName(null, "root"),
  +                createContextBean(),
  +                Locale.getDefault());
           NodeIterator it;
   
           PropertyPointer start = null;
   
  -        if (useStartLocation){
  +        if (useStartLocation) {
               start = root.getPropertyPointer();
               start.setPropertyIndex(propertyIndex);
               start.setIndex(offset);
  @@ -196,26 +211,34 @@
           it = root.childIterator(null, reverse, start);
   
           int size = 0;
  -        while(it.setPosition(it.getPosition() + 1)){
  +        while (it.setPosition(it.getPosition() + 1)) {
   //            System.err.println("LOC: " + it.getCurrentNodePointer());
               size++;
           }
  -        assertEquals("ITERATIONS: Multiple, propertyIndex=" + propertyIndex +
  -            ", offset=" + offset + ", useStartLocation=" + useStartLocation +
  -            ", reverse=" + reverse, expected, size);
  +        assertEquals(
  +            "ITERATIONS: Multiple, propertyIndex="
  +                + propertyIndex
  +                + ", offset="
  +                + offset
  +                + ", useStartLocation="
  +                + useStartLocation
  +                + ", reverse="
  +                + reverse,
  +            expected,
  +            size);
       }
   
  -    private int relativeProperty(PropertyPointer holder, int offset){
  +    private int relativeProperty(PropertyPointer holder, int offset) {
           String[] names = holder.getPropertyNames();
  -        for (int i = 0; i < names.length; i++){
  -            if (names[i].equals("integers")){
  +        for (int i = 0; i < names.length; i++) {
  +            if (names[i].equals("integers")) {
                   return i + offset;
               }
           }
           return -1;
       }
   
  -    public void testIteratePropertyArrayWithHasNext(){
  +    public void testIteratePropertyArrayWithHasNext() {
           JXPathContext context = JXPathContext.newContext(createContextBean());
           Iterator it = context.iteratePointers("/integers");
           List actual = new ArrayList();
  @@ -249,23 +272,25 @@
               actual);
       }
   
  -    public void testIterateAndSet(){
  +    public void testIterateAndSet() {
           JXPathContext context = JXPathContext.newContext(createContextBean());
   
           Iterator it = context.iteratePointers("beans/int");
           int i = 5;
  -        while (it.hasNext()){
  -            NodePointer pointer = (NodePointer)it.next();
  +        while (it.hasNext()) {
  +            NodePointer pointer = (NodePointer) it.next();
               pointer.setValue(new Integer(i++));
           }
   
           it = context.iteratePointers("beans/int");
           List actual = new ArrayList();
  -        while (it.hasNext()){
  -            actual.add(((Pointer)it.next()).getValue());
  +        while (it.hasNext()) {
  +            actual.add(((Pointer) it.next()).getValue());
           }
  -        assertEquals("Iterating <" + "beans/int" + ">",
  -                list(new Integer(5), new Integer(6)), actual);
  +        assertEquals(
  +            "Iterating <" + "beans/int" + ">",
  +            list(new Integer(5), new Integer(6)),
  +            actual);
       }
   
       /**
  @@ -285,10 +310,10 @@
           context.setValue("/beans[2]/name", "Name 2");
           assertXPathValue(context, "/beans[2]/name", "Name 2");
   
  -        int iter_count = 0;
  +        int iterCount = 0;
           Iterator iter = context.iteratePointers("/beans/name");
           while (iter.hasNext()) {
  -            iter_count++;
  +            iterCount++;
               Pointer pointer = (Pointer) iter.next();
               String s = (String) pointer.getValue();
               s = s + "suffix";
  @@ -300,406 +325,382 @@
                   s,
                   context.getValue(pointer.asPath()));
           }
  -        assertEquals("Iteration count", 2, iter_count);
  +        assertEquals("Iteration count", 2, iterCount);
   
           assertXPathValue(context, "/beans[1]/name", "Name 1suffix");
           assertXPathValue(context, "/beans[2]/name", "Name 2suffix");
       }
   
  -    public void testRoot(){
  -        assertXPathValueAndPointer(context,
  -                "/",
  -                context.getContextBean(),
  -                "/");
  +    public void testRoot() {
  +        assertXPathValueAndPointer(context, "/", context.getContextBean(), "/");
       }
   
  -    public void testAxisAncestor(){
  +    public void testAxisAncestor() {
           // ancestor::
  -        assertXPathValue(context,
  -                "int/ancestor::root = /",
  -                Boolean.TRUE);
  -
  -        assertXPathValue(context,
  -                "count(beans/name/ancestor-or-self::node())",
  -                new Double(5));
  -
  -        assertXPathValue(context,
  -                "beans/name/ancestor-or-self::node()[3] = /",
  -                Boolean.TRUE);
  -    }
  -
  -    public void testAxisChild(){
  -        assertXPathValue(context,
  -                "boolean",
  -                Boolean.FALSE);
  -
  -        assertXPathPointer(context,
  -                "boolean",
  -                "/boolean");
  -
  -        assertXPathPointerIterator(context,
  -                "boolean",
  -                list("/boolean"));
  +        assertXPathValue(context, "int/ancestor::root = /", Boolean.TRUE);
  +
  +        assertXPathValue(
  +            context,
  +            "count(beans/name/ancestor-or-self::node())",
  +            new Double(5));
  +
  +        assertXPathValue(
  +            context,
  +            "beans/name/ancestor-or-self::node()[3] = /",
  +            Boolean.TRUE);
  +    }
  +
  +    public void testAxisChild() {
  +        assertXPathValue(context, "boolean", Boolean.FALSE);
  +
  +        assertXPathPointer(context, "boolean", "/boolean");
  +
  +        assertXPathPointerIterator(context, "boolean", list("/boolean"));
   
           // Count elements in a child collection
  -        assertXPathValue(context,
  -                "count(set)",
  -                new Double(3));
  +        assertXPathValue(context, "count(set)", new Double(3));
   
   //        assertXPathValue(context,"boolean/class/name", "java.lang.Boolean");
   
           // Child with namespace - should not find any
  -        assertXPathValueIterator(context,
  -                "foo:boolean",
  -                list());
  +        assertXPathValueIterator(context, "foo:boolean", list());
   
           // Count all children with a wildcard
  -        assertXPathValue(context,
  -                "count(*)",
  -                new Double(21));
  +        assertXPathValue(context, "count(*)", new Double(21));
   
           // Same, constrained by node type = node()
  -        assertXPathValue(context,
  -                "count(child::node())",
  -                new Double(21));
  +        assertXPathValue(context, "count(child::node())", new Double(21));
       }
   
  -    public void testAxisChildNestedBean(){
  +    public void testAxisChildNestedBean() {
           // Nested bean
  -        assertXPathValue(context,
  -                "nestedBean/name",
  -                "Name 0");
  -
  -        assertXPathPointer(context,
  -                "nestedBean/name",
  -                "/nestedBean/name");
  -
  -        assertXPathPointerIterator(context,
  -                "nestedBean/name",
  -                list("/nestedBean/name"));
  -    }
  -
  -    public void testAxisChildNestedCollection(){
  -        assertXPathValueIterator(context,
  -                "integers",
  -                list(new Integer(1), new Integer(2),
  -                     new Integer(3), new Integer(4)));
  -
  -        assertXPathPointer(context,
  -                "integers",
  -                "/integers");
  -
  -        assertXPathPointerIterator(context,
  -                "integers",
  -                list("/integers[1]", "/integers[2]",
  -                     "/integers[3]", "/integers[4]"));
  -    }
  -
  -    public void testIndexPredicate(){
  -        assertXPathValue(context,
  -                "integers[2]",
  -                new Integer(2));
  -
  -        assertXPathPointer(context,
  -                "integers[2]",
  -                "/integers[2]");
  -
  -        assertXPathPointerIterator(context,
  -                "integers[2]",
  -                list("/integers[2]"));
  -
  -        assertXPathValue(context,
  -                "beans[1]/name",
  -                "Name 1");
  -
  -        assertXPathPointer(context,
  -                "beans[1]/name",
  -                "/beans[1]/name");
  -
  -        assertXPathValueIterator(context,
  -                "beans[1]/strings",
  -                list("String 1", "String 2", "String 3"));
  -
  -        assertXPathValueIterator(context,
  -                "beans/strings[2]",
  -                list("String 2", "String 2"));
  +        assertXPathValue(context, "nestedBean/name", "Name 0");
  +
  +        assertXPathPointer(context, "nestedBean/name", "/nestedBean/name");
  +
  +        assertXPathPointerIterator(
  +            context,
  +            "nestedBean/name",
  +            list("/nestedBean/name"));
  +    }
  +
  +    public void testAxisChildNestedCollection() {
  +        assertXPathValueIterator(
  +            context,
  +            "integers",
  +            list(
  +                new Integer(1),
  +                new Integer(2),
  +                new Integer(3),
  +                new Integer(4)));
  +
  +        assertXPathPointer(context, "integers", "/integers");
  +
  +        assertXPathPointerIterator(
  +            context,
  +            "integers",
  +            list(
  +                "/integers[1]",
  +                "/integers[2]",
  +                "/integers[3]",
  +                "/integers[4]"));
  +    }
  +
  +    public void testIndexPredicate() {
  +        assertXPathValue(context, "integers[2]", new Integer(2));
  +
  +        assertXPathPointer(context, "integers[2]", "/integers[2]");
  +
  +        assertXPathPointerIterator(
  +            context,
  +            "integers[2]",
  +            list("/integers[2]"));
  +
  +        assertXPathValue(context, "beans[1]/name", "Name 1");
  +
  +        assertXPathPointer(context, "beans[1]/name", "/beans[1]/name");
  +
  +        assertXPathValueIterator(
  +            context,
  +            "beans[1]/strings",
  +            list("String 1", "String 2", "String 3"));
  +
  +        assertXPathValueIterator(
  +            context,
  +            "beans/strings[2]",
  +            list("String 2", "String 2"));
   
           // Find the first match
  -        assertXPathValue(context,
  -                "beans/strings[2]",
  -                "String 2");
  +        assertXPathValue(context, "beans/strings[2]", "String 2");
   
           // Indexing in a set collected from a UnionContext
  -        assertXPathValue(context,
  -                "(beans/strings[2])[1]",
  -                "String 2");
  +        assertXPathValue(context, "(beans/strings[2])[1]", "String 2");
       }
   
  -    public void testAxisDescendant(){
  -       // descendant::
  -        assertXPathValue(context,
  -                "count(descendant::node())",
  -                new Double(65));
  +    public void testAxisDescendant() {
  +        // descendant::
  +        assertXPathValue(context, "count(descendant::node())", new Double(65));
   
           // Should not find any descendants with name root
  -        assertXPathValue(context,
  -                "count(descendant::root)",
  -                new Double(0));
  +        assertXPathValue(context, "count(descendant::root)", new Double(0));
   
  -        assertXPathValue(context,
  -                "count(descendant::name)",
  -                new Double(7));
  +        assertXPathValue(context, "count(descendant::name)", new Double(7));
       }
   
  -    public void testAxisDescendantOrSelf(){
  +    public void testAxisDescendantOrSelf() {
           // descendant-or-self::
  -        assertXPathValueIterator(context,
  -                "descendant-or-self::name",
  -                set("Name 1", "Name 2", "Name 3", "Name 6",
  -                     "Name 0", "Name 5", "Name 4"));
  +        assertXPathValueIterator(
  +            context,
  +            "descendant-or-self::name",
  +            set(
  +                "Name 1",
  +                "Name 2",
  +                "Name 3",
  +                "Name 6",
  +                "Name 0",
  +                "Name 5",
  +                "Name 4"));
   
           // Same - abbreviated syntax
  -        assertXPathValueIterator(context,
  -                "//name",
  -                set("Name 1", "Name 2", "Name 3", "Name 6",
  -                     "Name 0", "Name 5", "Name 4"));
  +        assertXPathValueIterator(
  +            context,
  +            "//name",
  +            set(
  +                "Name 1",
  +                "Name 2",
  +                "Name 3",
  +                "Name 6",
  +                "Name 0",
  +                "Name 5",
  +                "Name 4"));
   
           // See that it actually finds self
  -        assertXPathValue(context,
  -                "count(descendant-or-self::root)",
  -                new Double(1));
  +        assertXPathValue(
  +            context,
  +            "count(descendant-or-self::root)",
  +            new Double(1));
   
           // Combine descendant-or-self:: and and self::
  -        assertXPathValue(context,
  -                "count(nestedBean//.)",
  -                new Double(7));
  +        assertXPathValue(context, "count(nestedBean//.)", new Double(7));
   
           // Combine descendant-or-self:: and and self::name
  -        assertXPathValue(context,
  -                "count(//self::beans)",
  -                new Double(2));
  +        assertXPathValue(context, "count(//self::beans)", new Double(2));
   
           // Count all nodes in the tree
  -        assertXPathValue(context,
  -                "count(descendant-or-self::node())",
  -                new Double(66));
  +        assertXPathValue(
  +            context,
  +            "count(descendant-or-self::node())",
  +            new Double(66));
   
       }
   
  -    public void testAxisFollowing(){
  +    public void testAxisFollowing() {
           // following::
  -        assertXPathValue(context,
  -                "count(nestedBean/strings[2]/following::node())",
  -                new Double(21));
  +        assertXPathValue(
  +            context,
  +            "count(nestedBean/strings[2]/following::node())",
  +            new Double(21));
   
  -        assertXPathValue(context,
  -                "count(nestedBean/strings[2]/following::strings)",
  -                new Double(7));
  +        assertXPathValue(
  +            context,
  +            "count(nestedBean/strings[2]/following::strings)",
  +            new Double(7));
       }
   
  -    public void testAxisFollowingSibling(){
  +    public void testAxisFollowingSibling() {
           // following-sibling::
  -        assertXPathValue(context,
  -                "count(/nestedBean/following-sibling::node())",
  -                new Double(8));
  -
  -        assertXPathValue(context,
  -                "count(/nestedBean/following-sibling::object)",
  -                new Double(1));
  +        assertXPathValue(
  +            context,
  +            "count(/nestedBean/following-sibling::node())",
  +            new Double(8));
  +
  +        assertXPathValue(
  +            context,
  +            "count(/nestedBean/following-sibling::object)",
  +            new Double(1));
   
           // Combine parent:: and following-sibling::
  -        assertXPathValue(context,
  -                "count(/nestedBean/boolean/../following-sibling::node())",
  -                new Double(8));
  -
  -        assertXPathValue(context,
  -                "count(/nestedBean/boolean/../following-sibling::object)",
  -                new Double(1));
  +        assertXPathValue(
  +            context,
  +            "count(/nestedBean/boolean/../following-sibling::node())",
  +            new Double(8));
  +
  +        assertXPathValue(
  +            context,
  +            "count(/nestedBean/boolean/../following-sibling::object)",
  +            new Double(1));
   
           // Combine descendant:: and following-sibling::
  -        assertXPathValue(context,
  -                "count(/descendant::boolean/following-sibling::node())",
  -                new Double(53));
  +        assertXPathValue(
  +            context,
  +            "count(/descendant::boolean/following-sibling::node())",
  +            new Double(53));
   
  -        assertXPathValue(context,
  -                "count(/descendant::boolean/following-sibling::name)",
  -                new Double(7));
  +        assertXPathValue(
  +            context,
  +            "count(/descendant::boolean/following-sibling::name)",
  +            new Double(7));
       }
   
  -    public void testAxisParent(){
  +    public void testAxisParent() {
           // parent::
  -        assertXPathValue(context,
  -                "count(/beans/..)",
  -                new Double(1));
  +        assertXPathValue(context, "count(/beans/..)", new Double(1));
   
  -        assertXPathValue(context,
  -                "count(//..)",
  -                new Double(9));
  +        assertXPathValue(context, "count(//..)", new Double(9));
   
  -        assertXPathValue(context,
  -                "count(//../..)",
  -                new Double(2));
  +        assertXPathValue(context, "count(//../..)", new Double(2));
   
  -        assertXPathValueIterator(context,
  -                "//parent::beans/name",
  -                list("Name 1", "Name 2"));
  +        assertXPathValueIterator(
  +            context,
  +            "//parent::beans/name",
  +            list("Name 1", "Name 2"));
       }
   
  -    public void testAxisPreceding(){
  +    public void testAxisPreceding() {
           // preceding::
  -        assertXPathValue(context,
  -                "count(beans[2]/int/preceding::node())",
  -                new Double(8));
  +        assertXPathValue(
  +            context,
  +            "count(beans[2]/int/preceding::node())",
  +            new Double(8));
   
  -        assertXPathValue(context,
  -                "count(beans[2]/int/preceding::boolean)",
  -                new Double(2));
  +        assertXPathValue(
  +            context,
  +            "count(beans[2]/int/preceding::boolean)",
  +            new Double(2));
       }
   
  -    public void testAxisPrecedingSibling(){
  +    public void testAxisPrecedingSibling() {
           // preceding-sibling::
  -        assertXPathValue(context,
  -                "count(/boolean/preceding-sibling::node())",
  -                new Double(2));
  +        assertXPathValue(
  +            context,
  +            "count(/boolean/preceding-sibling::node())",
  +            new Double(2));
   
  -        assertXPathValue(context,
  -                "count(/nestedBean/int/../preceding-sibling::node())",
  -                new Double(12));
  +        assertXPathValue(
  +            context,
  +            "count(/nestedBean/int/../preceding-sibling::node())",
  +            new Double(12));
   
  -        assertXPathValue(context,
  -                "count(/descendant::int/preceding-sibling::node())",
  -                new Double(10));
  +        assertXPathValue(
  +            context,
  +            "count(/descendant::int/preceding-sibling::node())",
  +            new Double(10));
       }
   
  -    public void testAxisSelf(){
  +    public void testAxisSelf() {
           // self::
  -        assertXPathValue(context,
  -                "self::node() = /",
  -                Boolean.TRUE);
  +        assertXPathValue(context, "self::node() = /", Boolean.TRUE);
   
  -        assertXPathValue(context,
  -                "self::root = /",
  -                Boolean.TRUE);
  +        assertXPathValue(context, "self::root = /", Boolean.TRUE);
       }
   
  -    public void testUnion(){
  +    public void testUnion() {
           // Union - note corrected document order
  -        assertXPathValueIterator(context,
  -                "integers | beans[1]/strings",
  -                list("String 1", "String 2", "String 3",
  -                     new Integer(1), new Integer(2),
  -                     new Integer(3), new Integer(4)));
  -
  -        assertXPathValue(context,
  -                "count((integers | beans[1]/strings)[contains(., '1')])",
  -                new Double(2));
  -
  -        assertXPathValue(context,
  -                "count((integers | beans[1]/strings)[name(.) = 'strings'])",
  -                new Double(3));
  +        assertXPathValueIterator(
  +            context,
  +            "integers | beans[1]/strings",
  +            list(
  +                "String 1",
  +                "String 2",
  +                "String 3",
  +                new Integer(1),
  +                new Integer(2),
  +                new Integer(3),
  +                new Integer(4)));
  +
  +        assertXPathValue(
  +            context,
  +            "count((integers | beans[1]/strings)[contains(., '1')])",
  +            new Double(2));
  +
  +        assertXPathValue(
  +            context,
  +            "count((integers | beans[1]/strings)[name(.) = 'strings'])",
  +            new Double(3));
   
           // Note that the following is different from "integer[2]" -
           // it is a filter expression
  -        assertXPathValue(context,
  -                "(integers)[2]",
  -                new Integer(2));
  -     }
  +        assertXPathValue(context, "(integers)[2]", new Integer(2));
  +    }
   
  -    public void testAxisAttribute(){
  +    public void testAxisAttribute() {
           // Attributes are just like children to beans
  -        assertXPathValue(context,
  -                "count(@*)",
  -                new Double(21.0));
  +        assertXPathValue(context, "count(@*)", new Double(21.0));
   
           // Unknown attribute
  -        assertXPathValueLenient(context,
  -                "@foo",
  -                null);
  +        assertXPathValueLenient(context, "@foo", null);
       }
   
       /**
        * Testing the pseudo-attribute "name" that java beans
        * objects appear to have.
        */
  -    public void testAttributeName(){
  -        assertXPathValue(context,
  -                "nestedBean[@name = 'int']",
  -                new Integer(1));
  -
  -        assertXPathPointer(context,
  -                "nestedBean[@name = 'int']",
  -                "/nestedBean/int");
  +    public void testAttributeName() {
  +        assertXPathValue(context, "nestedBean[@name = 'int']", new Integer(1));
  +
  +        assertXPathPointer(
  +            context,
  +            "nestedBean[@name = 'int']",
  +            "/nestedBean/int");
       }
   
       public void testAttributeLang() {
   
  -        assertXPathValue(context, 
  -            "@xml:lang", 
  -            "en-US");
  +        assertXPathValue(context, "@xml:lang", "en-US");
   
  -        assertXPathValue(context, 
  -            "count(@xml:*)", 
  -            new Double(1));
  +        assertXPathValue(context, "count(@xml:*)", new Double(1));
   
  -        assertXPathValue(context, 
  -            "lang('en')", 
  -            Boolean.TRUE);
  -            
  -        assertXPathValue(context, 
  -            "lang('fr')", 
  -            Boolean.FALSE);
  +        assertXPathValue(context, "lang('en')", Boolean.TRUE);
  +
  +        assertXPathValue(context, "lang('fr')", Boolean.FALSE);
       }
  -    
  -    public void testCoreFunctions(){
  -            
  -        assertXPathValue(context, 
  -            "boolean(boolean)", 
  -            Boolean.TRUE);
   
  -        assertXPathValue(context,
  -            "boolean(boolean = false())",
  -            Boolean.TRUE);
  -            
  +    public void testCoreFunctions() {
  +
  +        assertXPathValue(context, "boolean(boolean)", Boolean.TRUE);
  +
  +        assertXPathValue(context, "boolean(boolean = false())", Boolean.TRUE);
  +
           assertXPathValue(
               context,
               "boolean(integers[position() < 3])",
               Boolean.TRUE);
  -            
  +
           assertXPathValue(
               context,
               "boolean(integers[position() > 4])",
               Boolean.FALSE);
  -            
  -        assertXPathValue(context, 
  -            "sum(integers)", 
  -            new Double(10));
  +
  +        assertXPathValue(context, "sum(integers)", new Double(10));
       }
   
  -    public void testBooleanPredicate(){
  +    public void testBooleanPredicate() {
           // use child axis
  -        
  +
           // bean[1]/int = 1
           // bean[2]/int = 3
  -        
  -        assertXPathValue(context,
  -                "beans[int > 2]/name",
  -                "Name 2");
  -
  -        assertXPathValueIterator(context,
  -                "beans[int > 2]/name",
  -                list("Name 2"));
  -
  -        assertXPathValueIterator(context,
  -                "beans[int >= 1]/name",
  -                list("Name 1", "Name 2"));
  -                
  -        assertXPathValueIterator(context,
  -                "beans[int < 2]/name",
  -                list("Name 1"));
  -                
  -        assertXPathValueIterator(context,
  -                "beans[int <= 3]/name",
  -                list("Name 1", "Name 2"));
  +
  +        assertXPathValue(context, "beans[int > 2]/name", "Name 2");
  +
  +        assertXPathValueIterator(
  +            context,
  +            "beans[int > 2]/name",
  +            list("Name 2"));
  +
  +        assertXPathValueIterator(
  +            context,
  +            "beans[int >= 1]/name",
  +            list("Name 1", "Name 2"));
  +
  +        assertXPathValueIterator(
  +            context,
  +            "beans[int < 2]/name",
  +            list("Name 1"));
  +
  +        assertXPathValueIterator(
  +            context,
  +            "beans[int <= 3]/name",
  +            list("Name 1", "Name 2"));
   
           assertXPathValueIterator(
               context,
  @@ -707,282 +708,236 @@
               list("String 1", "String 2", "String 3"));
   
           // use some fancy axis and the child axis in the predicate
  -        assertXPathValueIterator(context,
  -                "//self::node()[name = 'Name 0']/name",
  -                list("Name 0"));
  +        assertXPathValueIterator(
  +            context,
  +            "//self::node()[name = 'Name 0']/name",
  +            list("Name 0"));
   
           // use context-dependent function in the predicate
  -        assertXPathValue(context,
  -                "beans/strings[name(.)='strings'][2]",
  -                "String 2");
  +        assertXPathValue(
  +            context,
  +            "beans/strings[name(.)='strings'][2]",
  +            "String 2");
   
           // use context-independent function in the predicate
  -        assertXPathValueIterator(context,
  -                "//self::node()[name(.) = concat('n', 'a', 'm', 'e')]",
  -                list("Name 1", "Name 2", "Name 3", "Name 6",
  -                     "Name 0", "Name 5", "Name 4"));
  -
  -        assertXPathValueIterator(context,
  -                "integers[position()<3]",
  -                list(new Integer(1), new Integer(2)));
  -    }
  -
  -    public void testBooleanPredicateWithSearch(){
  -        context.getVariables().declareVariable(
  -            "numbers",
  -            new String[] { "2", "3" });
  -
  -        context.setValue("/beans[1]/strings", new String[] { "1", "2" });
  -        context.setValue("/beans[2]/strings", new String[] { "3", "4" });
  -
  -        // Find beans with any string == 2        
  -        assertXPathValueIterator(context,
  -            "/beans[strings = '2']/name",
  -            list("Name 1")
  -        );
  -
  -        // Find beans with any string in the variable $numbers
  -        assertXPathValueIterator(context,
  -            "/beans[strings = $numbers]/name",
  -            list("Name 1", "Name 2")
  -        );
  -
  -        // Find beans without any strings == 2
  -        assertXPathValueIterator(context,
  -            "/beans[strings != '2']/name",
  -            list("Name 2")
  -        );
  -
  -        assertXPathValueIterator(context,
  -            "/beans[strings > '1']/name",
  -            list("Name 1", "Name 2")
  -        );
  -
  -        assertXPathValueIterator(context,
  -            "/beans[strings > $numbers]/name",
  -            list("Name 2")
  -        );
  -
  -        assertXPathValueIterator(context,
  -            "/beans[strings >= '2']/name",
  -            list("Name 1", "Name 2")
  -        );
  -
  -        assertXPathValueIterator(context,
  -            "/beans[strings >= '3']/name",
  -            list("Name 2")
  -        );
  -        
  -        assertXPathValueIterator(context,
  -            "/beans[strings < '4']/name",
  -            list("Name 1", "Name 2")
  -        );
  -
  -        assertXPathValueIterator(context,
  -            "/beans[strings < 3]/name",
  -            list("Name 1")
  -        );
  -
  -        assertXPathValueIterator(context,
  -            "/beans[strings <= '3']/name",
  -            list("Name 1", "Name 2")
  -        );
  +        assertXPathValueIterator(
  +            context,
  +            "//self::node()[name(.) = concat('n', 'a', 'm', 'e')]",
  +            list(
  +                "Name 1",
  +                "Name 2",
  +                "Name 3",
  +                "Name 6",
  +                "Name 0",
  +                "Name 5",
  +                "Name 4"));
   
  -        assertXPathValueIterator(context,
  -            "/beans[strings <= '2']/name",
  -            list("Name 1")
  -        );
  +        assertXPathValueIterator(
  +            context,
  +            "integers[position()<3]",
  +            list(new Integer(1), new Integer(2)));
  +            
  +        context.getVariables().declareVariable("temp", context.getValue("beans"));
  +        
  +        assertXPathValueIterator(
  +            context,
  +            "$temp[int < 2]/int",
  +            list(new Integer(1)));
       }
  -    
  -    public void testDocumentOrder(){
  -        assertDocumentOrder(context,
  -                "boolean", "int", -1);
   
  -        assertDocumentOrder(context,
  -                "integers[1]", "integers[2]", -1);
  +    public void testDocumentOrder() {
  +        assertDocumentOrder(context, "boolean", "int", -1);
  +
  +        assertDocumentOrder(context, "integers[1]", "integers[2]", -1);
   
  -        assertDocumentOrder(context,
  -                "integers[1]", "integers[1]", 0);
  +        assertDocumentOrder(context, "integers[1]", "integers[1]", 0);
   
  -        assertDocumentOrder(context,
  -                "nestedBean/int", "nestedBean", 1);
  +        assertDocumentOrder(context, "nestedBean/int", "nestedBean", 1);
   
  -        assertDocumentOrder(context,
  -                "nestedBean/int", "nestedBean/strings", -1);
  +        assertDocumentOrder(
  +            context,
  +            "nestedBean/int",
  +            "nestedBean/strings",
  +            -1);
   
  -        assertDocumentOrder(context,
  -                "nestedBean/int", "object/int", -1);
  +        assertDocumentOrder(context, "nestedBean/int", "object/int", -1);
       }
   
  -    public void testSetPropertyValue(){
  +    public void testSetPropertyValue() {
           // Simple property
  -        assertXPathSetValue(context,
  -                "int",
  -                new Integer(2));
  +        assertXPathSetValue(context, "int", new Integer(2));
   
           // Simple property with conversion from string
  -        assertXPathSetValue(context,
  -                "int",
  -                "3",
  -                new Integer(3));
  +        assertXPathSetValue(context, "int", "3", new Integer(3));
   
           // Simple property with conversion from array
  -        assertXPathSetValue(context,
  -                "int",
  -                new int[]{4},
  -                new Integer(4));
  +        assertXPathSetValue(context, "int", new int[] { 4 }, new Integer(4));
   
           // Attribute (which is the same as a child for beans
  -        assertXPathSetValue(context,
  -                "@int",
  -                new Integer(10));
  +        assertXPathSetValue(context, "@int", new Integer(10));
       }
   
  -    public void testSetCollectionElement(){
  +    public void testSetCollectionElement() {
           // Collection element
  -        assertXPathSetValue(context,
  -                "integers[2]",
  -                new Integer(5));
  +        assertXPathSetValue(context, "integers[2]", new Integer(5));
   
           // Collection element with conversion
  -        assertXPathSetValue(context,
  -                "integers[2]",
  -                new int[]{6},
  -                new Integer(6));
  +        assertXPathSetValue(
  +            context,
  +            "integers[2]",
  +            new int[] { 6 },
  +            new Integer(6));
       }
   
  -    public void testSetContextDependentNode(){
  +    public void testSetContextDependentNode() {
           // Find node without using SimplePathInterpreter
  -        assertXPathSetValue(context,
  -                "integers[position() = 1]",
  -                new Integer(8));
  +        assertXPathSetValue(
  +            context,
  +            "integers[position() = 1]",
  +            new Integer(8));
   
           // Find node without using SimplePathInterpreter and set its property
  -        assertXPathSetValue(context,
  -                "beans[name = 'Name 1']/int",
  -                new Integer(9));
  +        assertXPathSetValue(
  +            context,
  +            "beans[name = 'Name 1']/int",
  +            new Integer(9));
   
       }
   
  -    public void testSetNonPrimitiveValue(){
  +    public void testSetNonPrimitiveValue() {
           // First, let's see if we can set a collection element to null
  -        assertXPathSetValue(context,
  -                "beans[2]",
  -                null);
  +        assertXPathSetValue(context, "beans[2]", null);
   
           // Now, assign it a whole bean
           context.setValue("beans[2]", new NestedTestBean("Name 9"));
   
  -        assertEquals("Modified <" + "beans[2]/name" + ">",
  -            "Name 9", context.getValue("beans[2]/name"));
  +        assertEquals(
  +            "Modified <" + "beans[2]/name" + ">",
  +            "Name 9",
  +            context.getValue("beans[2]/name"));
       }
   
  -    public void testCreatePath(){
  +    public void testCreatePath() {
           context.setValue("nestedBean", null);
   
           // Calls factory.createObject(..., TestBean, "nestedBean")
  -        assertXPathCreatePath(context,
  -                "/nestedBean/int",
  -                new Integer(1),
  -                "/nestedBean/int");
  +        assertXPathCreatePath(
  +            context,
  +            "/nestedBean/int",
  +            new Integer(1),
  +            "/nestedBean/int");
       }
   
  -    public void testCreatePathAndSetValue(){
  +    public void testCreatePathAndSetValue() {
           context.setValue("nestedBean", null);
   
           // Calls factory.createObject(..., TestBean, "nestedBean")
  -        assertXPathCreatePathAndSetValue(context,
  -                "/nestedBean/int",
  -                new Integer(2),
  -                "/nestedBean/int");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/nestedBean/int",
  +            new Integer(2),
  +            "/nestedBean/int");
       }
   
  -    public void testCreatePathExpandNewCollection(){
  +    public void testCreatePathExpandNewCollection() {
           context.setValue("beans", null);
   
           // Calls factory.createObject(..., testBean, "beans", 2), 
           // then  factory.createObject(..., testBean, "beans", 2)
  -        assertXPathCreatePath(context,
  -                "/beans[2]/int",
  -                new Integer(1),
  -                "/beans[2]/int");
  +        assertXPathCreatePath(
  +            context,
  +            "/beans[2]/int",
  +            new Integer(1),
  +            "/beans[2]/int");
       }
   
  -    public void testCreatePathAndSetValueExpandNewCollection(){
  +    public void testCreatePathAndSetValueExpandNewCollection() {
           context.setValue("beans", null);
   
           // Calls factory.createObject(..., testBean, "beans", 2), 
           // then factory.createObject(..., testBean, "beans", 2)
  -        assertXPathCreatePathAndSetValue(context,
  -                "/beans[2]/int",
  -                new Integer(2),
  -                "/beans[2]/int");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/beans[2]/int",
  +            new Integer(2),
  +            "/beans[2]/int");
       }
   
  -    public void testCreatePathExpandExistingCollection(){
  +    public void testCreatePathExpandExistingCollection() {
           // Calls factory.createObject(..., TestBean, "integers", 5)
           // to expand collection
  -        assertXPathCreatePathAndSetValue(context,
  +        assertXPathCreatePathAndSetValue(
  +            context,
               "/integers[5]",
               new Integer(3),
  -            "/integers[5]");     
  +            "/integers[5]");
       }
  -    
  -    public void testCreatePathExpandExistingCollectionAndSetProperty(){
  +
  +    public void testCreatePathExpandExistingCollectionAndSetProperty() {
           // Another, but the collection already exists
  -        assertXPathCreatePath(context,
  -                "/beans[3]/int",
  -                new Integer(1),
  -                "/beans[3]/int");
  +        assertXPathCreatePath(
  +            context,
  +            "/beans[3]/int",
  +            new Integer(1),
  +            "/beans[3]/int");
       }
   
  -    public void testCreatePathAndSetValueExpandExistingCollection(){
  +    public void testCreatePathAndSetValueExpandExistingCollection() {
           // Another, but the collection already exists
  -        assertXPathCreatePathAndSetValue(context,
  -                "/beans[3]/int",
  -                new Integer(2),
  -                "/beans[3]/int");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/beans[3]/int",
  +            new Integer(2),
  +            "/beans[3]/int");
       }
   
  -    public void testCreatePathCreateBeanExpandCollection(){
  +    public void testCreatePathCreateBeanExpandCollection() {
           context.setValue("nestedBean", null);
   
           // Calls factory.createObject(..., TestBean, "nestedBean")
           // Calls factory.createObject(..., nestedBean, "strings", 2)
  -        assertXPathCreatePath(context,
  -                "/nestedBean/strings[2]",
  -                "String 2",
  -                "/nestedBean/strings[2]");
  +        assertXPathCreatePath(
  +            context,
  +            "/nestedBean/strings[2]",
  +            "String 2",
  +            "/nestedBean/strings[2]");
       }
   
  -    public void testCreatePathAndSetValueCreateBeanExpandCollection(){
  +    public void testCreatePathAndSetValueCreateBeanExpandCollection() {
           context.setValue("nestedBean", null);
   
           // Calls factory.createObject(..., TestBean, "nestedBean")
           // Calls factory.createObject(..., nestedBean, "strings", 2)
  -        assertXPathCreatePathAndSetValue(context,
  -                "/nestedBean/strings[2]",
  -                "Test",
  -                "/nestedBean/strings[2]");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/nestedBean/strings[2]",
  +            "Test",
  +            "/nestedBean/strings[2]");
       }
  -        
  -    public void testRemovePathPropertyValue(){
  +
  +    public void testRemovePathPropertyValue() {
           // Remove property value
           context.removePath("nestedBean/int");
  -        assertEquals("Remove property value", new Integer(0),
  -                    context.getValue("nestedBean/int"));
  +        assertEquals(
  +            "Remove property value",
  +            new Integer(0),
  +            context.getValue("nestedBean/int"));
       }
   
  -    public void testRemovePathArrayElement(){
  +    public void testRemovePathArrayElement() {
           // Assigns a new array to the property
           context.removePath("nestedBean/strings[1]");
  -        assertEquals("Remove array element", "String 2",
  -                    context.getValue("nestedBean/strings[1]"));
  +        assertEquals(
  +            "Remove array element",
  +            "String 2",
  +            context.getValue("nestedBean/strings[1]"));
       }
   
  -    public void testRemovePathBeanValue(){
  +    public void testRemovePathBeanValue() {
           context.removePath("nestedBean");
  -        assertEquals("Remove collection element", null,
  -                    context.getValue("nestedBean"));
  +        assertEquals(
  +            "Remove collection element",
  +            null,
  +            context.getValue("nestedBean"));
       }
   }
  
  
  
  1.2       +5 -5      jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/ExceptionPropertyTestBean.java
  
  Index: ExceptionPropertyTestBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/ExceptionPropertyTestBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExceptionPropertyTestBean.java	28 Nov 2002 01:02:05 -0000	1.1
  +++ ExceptionPropertyTestBean.java	20 Jan 2003 00:00:28 -0000	1.2
  @@ -62,15 +62,15 @@
    */
   public class ExceptionPropertyTestBean {
   
  -    public String getErrorString(){
  +    public String getErrorString() {
           throw new RuntimeException("errorString");
       }
  -    
  -    public String[] getErrorStringArray(){
  +
  +    public String[] getErrorStringArray() {
           throw new RuntimeException("errorStringArray");
       }
   
  -    public TestBean getErrorBean(){
  +    public TestBean getErrorBean() {
           throw new RuntimeException("errorBean");
       }
   }
  
  
  
  1.5       +302 -293  jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/MixedModelTest.java
  
  Index: MixedModelTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/MixedModelTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MixedModelTest.java	11 Jan 2003 05:41:27 -0000	1.4
  +++ MixedModelTest.java	20 Jan 2003 00:00:28 -0000	1.5
  @@ -89,8 +89,7 @@
    * @version $Revision$ $Date$
    */
   
  -public class MixedModelTest extends JXPathTestCase
  -{
  +public class MixedModelTest extends JXPathTestCase {
       private JXPathContext context;
   
       /**
  @@ -98,18 +97,18 @@
        *
        * @param name Name of the test case
        */
  -    public MixedModelTest(String name){
  +    public MixedModelTest(String name) {
           super(name);
       }
   
       /**
        * Return the tests included in this test suite.
        */
  -    public static Test suite(){
  +    public static Test suite() {
           return (new TestSuite(MixedModelTest.class));
       }
   
  -    public void setUp(){
  +    public void setUp() {
           TestMixedModelBean bean = new TestMixedModelBean();
           context = JXPathContext.newContext(bean);
           context.setFactory(new TestMixedModelFactory());
  @@ -123,191 +122,204 @@
           vars.declareVariable("element", bean.getElement());
           vars.declareVariable("container", bean.getContainer());
           vars.declareVariable("testnull", new TestNull());
  -        
  +
           int[][] matrix = new int[1][];
           matrix[0] = new int[1];
           matrix[0][0] = 3;
           vars.declareVariable("matrix", matrix);
       }
   
  -    public void testVarPrimitive(){
  -        assertXPathValueAndPointer(context,
  -                "$string",
  -                "string",
  -                "$string");
  -    }
  +    public void testVar() {
  +        context.getVariables().declareVariable("foo:bar", "baz");
   
  -    public void testVarBean(){
  -        assertXPathValueAndPointer(context,
  -                "$bean/int",
  -                new Integer(1),
  -                "$bean/int");
  +        assertXPathValueAndPointer(context, 
  +            "$foo:bar", 
  +            "baz", 
  +            "$foo:bar");
  +        
  +    }
  +    
  +    public void testVarPrimitive() {
  +        assertXPathValueAndPointer(context, "$string", "string", "$string");
       }
   
  -    public void testVarMap(){
  -        assertXPathValueAndPointer(context,
  -                "$map/string",
  -                "string",
  -                "$map[@name='string']");
  +    public void testVarBean() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "$bean/int",
  +            new Integer(1),
  +            "$bean/int");
       }
   
  -    public void testVarList(){
  -        assertXPathValueAndPointer(context,
  -                "$list[1]",
  -                "string",
  -                "$list[1]");
  +    public void testVarMap() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "$map/string",
  +            "string",
  +            "$map[@name='string']");
       }
   
  -    public void testVarDocument(){
  -        assertXPathValueAndPointer(context,
  -                "$document/vendor/location/address/city",
  -                "Fruit Market",
  -                "$document/vendor[1]/location[2]/address[1]/city[1]");
  +    public void testVarList() {
  +        assertXPathValueAndPointer(context, "$list[1]", "string", "$list[1]");
       }
   
  -    public void testVarElement(){
  -        assertXPathValueAndPointer(context,
  -                "$element/location/address/city",
  -                "Fruit Market",
  -                "$element/location[2]/address[1]/city[1]");
  +    public void testVarDocument() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "$document/vendor/location/address/city",
  +            "Fruit Market",
  +            "$document/vendor[1]/location[2]/address[1]/city[1]");
       }
   
  -    public void testVarContainer(){
  -        assertXPathValueAndPointer(context,
  -                "$container/vendor/location/address/city",
  -                "Fruit Market",
  -                "$container/vendor[1]/location[2]/address[1]/city[1]");
  +    public void testVarElement() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "$element/location/address/city",
  +            "Fruit Market",
  +            "$element/location[2]/address[1]/city[1]");
       }
   
  +    public void testVarContainer() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "$container/vendor/location/address/city",
  +            "Fruit Market",
  +            "$container/vendor[1]/location[2]/address[1]/city[1]");
  +    }
   
       // ----------------------------------------------------------------------
   
  -    public void testBeanPrimitive(){
  -        assertXPathValueAndPointer(context,
  -                "string",
  -                "string",
  -                "/string");
  +    public void testBeanPrimitive() {
  +        assertXPathValueAndPointer(context, "string", "string", "/string");
       }
   
  -    public void testBeanBean(){
  -        assertXPathValueAndPointer(context,
  -                "bean/int",
  -                new Integer(1),
  -                "/bean/int");
  +    public void testBeanBean() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "bean/int",
  +            new Integer(1),
  +            "/bean/int");
       }
   
  -    public void testBeanMap(){
  -        assertXPathValueAndPointer(context,
  -                "map/string",
  -                "string",
  -                "/map[@name='string']");
  +    public void testBeanMap() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "map/string",
  +            "string",
  +            "/map[@name='string']");
       }
   
  -    public void testBeanList(){
  -        assertXPathValueAndPointer(context,
  -                "list[1]",
  -                "string",
  -                "/list[1]");
  +    public void testBeanList() {
  +        assertXPathValueAndPointer(context, "list[1]", "string", "/list[1]");
       }
   
  -    public void testBeanDocument(){
  -        assertXPathValueAndPointer(context,
  -                "document/vendor/location/address/city",
  -                "Fruit Market",
  -                "/document/vendor[1]/location[2]/address[1]/city[1]");
  +    public void testBeanDocument() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "document/vendor/location/address/city",
  +            "Fruit Market",
  +            "/document/vendor[1]/location[2]/address[1]/city[1]");
       }
   
  -    public void testBeanElement(){
  -        assertXPathValueAndPointer(context,
  -                "element/location/address/city",
  -                "Fruit Market",
  -                "/element/location[2]/address[1]/city[1]");
  +    public void testBeanElement() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "element/location/address/city",
  +            "Fruit Market",
  +            "/element/location[2]/address[1]/city[1]");
       }
   
  -    public void testBeanContainer(){
  -        assertXPathValueAndPointer(context,
  -                "container/vendor/location/address/city",
  -                "Fruit Market",
  -                "/container/vendor[1]/location[2]/address[1]/city[1]");
  +    public void testBeanContainer() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "container/vendor/location/address/city",
  +            "Fruit Market",
  +            "/container/vendor[1]/location[2]/address[1]/city[1]");
       }
   
       // ----------------------------------------------------------------------
   
  -    public void testMapPrimitive(){
  -        assertXPathValueAndPointer(context,
  -                "map/string",
  -                "string",
  -                "/map[@name='string']");
  -    }
  -
  -    public void testMapBean(){
  -        assertXPathValueAndPointer(context,
  -                "map/bean/int",
  -                new Integer(1),
  -                "/map[@name='bean']/int");
  -    }
  -
  -    public void testMapMap(){
  -        assertXPathValueAndPointer(context,
  -                "map/map/string",
  -                "string",
  -                "/map[@name='map'][@name='string']");
  -    }
  -
  -    public void testMapList(){
  -        assertXPathValueAndPointer(context,
  -                "map/list[1]",
  -                "string",
  -                "/map[@name='list'][1]");
  -    }
  -
  -    public void testMapDocument(){
  -        assertXPathValueAndPointer(context,
  -                "map/document/vendor/location/address/city",
  -                "Fruit Market",
  -                "/map[@name='document']" +
  -                        "/vendor[1]/location[2]/address[1]/city[1]");
  -    }
  -
  -    public void testMapElement(){
  -        assertXPathValueAndPointer(context,
  -                "map/element/location/address/city",
  -                "Fruit Market",
  -                "/map[@name='element']/location[2]/address[1]/city[1]");
  -    }
  -
  -    public void testMapContainer(){
  -        assertXPathValueAndPointer(context,
  -                "map/container/vendor/location/address/city",
  -                "Fruit Market",
  -                "/map[@name='container']" +
  -                        "/vendor[1]/location[2]/address[1]/city[1]");
  +    public void testMapPrimitive() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "map/string",
  +            "string",
  +            "/map[@name='string']");
  +    }
  +
  +    public void testMapBean() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "map/bean/int",
  +            new Integer(1),
  +            "/map[@name='bean']/int");
  +    }
  +
  +    public void testMapMap() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "map/map/string",
  +            "string",
  +            "/map[@name='map'][@name='string']");
  +    }
  +
  +    public void testMapList() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "map/list[1]",
  +            "string",
  +            "/map[@name='list'][1]");
  +    }
  +
  +    public void testMapDocument() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "map/document/vendor/location/address/city",
  +            "Fruit Market",
  +            "/map[@name='document']"
  +                + "/vendor[1]/location[2]/address[1]/city[1]");
  +    }
  +
  +    public void testMapElement() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "map/element/location/address/city",
  +            "Fruit Market",
  +            "/map[@name='element']/location[2]/address[1]/city[1]");
  +    }
  +
  +    public void testMapContainer() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "map/container/vendor/location/address/city",
  +            "Fruit Market",
  +            "/map[@name='container']"
  +                + "/vendor[1]/location[2]/address[1]/city[1]");
       }
   
       // ----------------------------------------------------------------------
   
  -    public void testListPrimitive(){
  -        assertXPathValueAndPointer(context,
  -                "list[1]",
  -                "string",
  -                "/list[1]");
  +    public void testListPrimitive() {
  +        assertXPathValueAndPointer(context, "list[1]", "string", "/list[1]");
       }
   
  -    public void testListBean(){
  -        assertXPathValueAndPointer(context,
  -                "list[2]/int",
  -                new Integer(1),
  -                "/list[2]/int");
  +    public void testListBean() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "list[2]/int",
  +            new Integer(1),
  +            "/list[2]/int");
       }
   
  -    public void testListMap(){
  -        assertXPathValueAndPointer(context,
  -                "list[3]/string",
  -                "string",
  -                "/list[3][@name='string']");
  +    public void testListMap() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "list[3]/string",
  +            "string",
  +            "/list[3][@name='string']");
       }
   
  -    public void testListList(){
  +    public void testListList() {
           /** @todo: what is this supposed to do? Should we stick to XPath,
            *  in which case [1] is simply ignored, or Java, in which case
            *  it is supposed to extract the first element from the list?
  @@ -317,152 +329,143 @@
   //                "string2",
   //                "/list[4][1]");
   
  -        assertXPathValueAndPointer(context,
  -                "list[4]/.[1]",
  -                "string2",
  -                "/list[4]/.[1]");
  -    }
  -
  -    public void testListDocument(){
  -        assertXPathValueAndPointer(context,
  -                "list[5]/vendor/location/address/city",
  -                "Fruit Market",
  -                "/list[5]/vendor[1]/location[2]/address[1]/city[1]");
  -    }
  -
  -    public void testListElement(){
  -        assertXPathValueAndPointer(context,
  -                "list[6]/location/address/city",
  -                "Fruit Market",
  -                "/list[6]/location[2]/address[1]/city[1]");
  -    }
  -
  -    public void testListContainer(){
  -        assertXPathValueAndPointer(context,
  -                "list[7]/vendor/location/address/city",
  -                "Fruit Market",
  -                "/list[7]/vendor[1]/location[2]/address[1]/city[1]");
  -    }
  -
  -    public void testNull(){
  -
  -        assertXPathPointerLenient(context, 
  -                "$null", 
  -                "$null");
  -                
  -        assertXPathPointerLenient(context, 
  -                "$null[3]", 
  -                "$null[3]");
  -                
  -        assertXPathPointerLenient(context, 
  -                "$testnull/nothing", 
  -                "$testnull/nothing");
  -                
  -        assertXPathPointerLenient(context, 
  -                "$testnull/nothing[2]", 
  -                "$testnull/nothing[2]");
  -        
  -        assertXPathPointerLenient(context, 
  -                "beans[8]/int", 
  -                "/beans[8]/int");
  -        
  -        assertXPathValueIterator(context, 
  -                "$testnull/nothing[1]", 
  -                Collections.EMPTY_LIST);
  -                
  +        assertXPathValueAndPointer(
  +            context,
  +            "list[4]/.[1]",
  +            "string2",
  +            "/list[4]/.[1]");
  +    }
  +
  +    public void testListDocument() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "list[5]/vendor/location/address/city",
  +            "Fruit Market",
  +            "/list[5]/vendor[1]/location[2]/address[1]/city[1]");
  +    }
  +
  +    public void testListElement() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "list[6]/location/address/city",
  +            "Fruit Market",
  +            "/list[6]/location[2]/address[1]/city[1]");
  +    }
  +
  +    public void testListContainer() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "list[7]/vendor/location/address/city",
  +            "Fruit Market",
  +            "/list[7]/vendor[1]/location[2]/address[1]/city[1]");
  +    }
  +
  +    public void testNull() {
  +
  +        assertXPathPointerLenient(context, "$null", "$null");
  +
  +        assertXPathPointerLenient(context, "$null[3]", "$null[3]");
  +
  +        assertXPathPointerLenient(
  +            context,
  +            "$testnull/nothing",
  +            "$testnull/nothing");
  +
  +        assertXPathPointerLenient(
  +            context,
  +            "$testnull/nothing[2]",
  +            "$testnull/nothing[2]");
  +
  +        assertXPathPointerLenient(context, "beans[8]/int", "/beans[8]/int");
  +
  +        assertXPathValueIterator(
  +            context,
  +            "$testnull/nothing[1]",
  +            Collections.EMPTY_LIST);
  +
           JXPathContext ctx = JXPathContext.newContext(new TestNull());
  -        assertXPathValue(ctx, 
  -                "nothing", 
  -                null);
  -                
  -        assertXPathValue(ctx, 
  -                "child/nothing", 
  -                null);
  -                
  -        assertXPathValue(ctx, 
  -                "array[2]", 
  -                null);
  -                
  -        assertXPathValueLenient(ctx, 
  -                "nothing/something", 
  -                null);
  -                
  -        assertXPathValueLenient(ctx, 
  -                "array[2]/something", 
  -                null);
  +        assertXPathValue(ctx, "nothing", null);
  +
  +        assertXPathValue(ctx, "child/nothing", null);
  +
  +        assertXPathValue(ctx, "array[2]", null);
  +
  +        assertXPathValueLenient(ctx, "nothing/something", null);
  +
  +        assertXPathValueLenient(ctx, "array[2]/something", null);
       }
  -    
  -    public void testRootAsCollection(){
  -        assertXPathValue(context, 
  -                ".[1]/string",
  -                "string");
  +
  +    public void testRootAsCollection() {
  +        assertXPathValue(context, ".[1]/string", "string");
       }
  -    
  -    public void testCreatePath(){
  +
  +    public void testCreatePath() {
           context = JXPathContext.newContext(new TestBean());
           context.setFactory(new TestMixedModelFactory());
  -        
  -        TestBean bean = (TestBean)context.getContextBean();
  +
  +        TestBean bean = (TestBean) context.getContextBean();
           bean.setMap(null);
   
  -        assertXPathCreatePath(context, 
  -                "/map[@name='TestKey5']/nestedBean/int", 
  -                new Integer(1),
  -                "/map[@name='TestKey5']/nestedBean/int");
  -                
  +        assertXPathCreatePath(
  +            context,
  +            "/map[@name='TestKey5']/nestedBean/int",
  +            new Integer(1),
  +            "/map[@name='TestKey5']/nestedBean/int");
  +
           bean.setMap(null);
  -        assertXPathCreatePath(context, 
  -                "/map[@name='TestKey5']/beans[2]/int", 
  -                new Integer(1),
  -                "/map[@name='TestKey5']/beans[2]/int");
  +        assertXPathCreatePath(
  +            context,
  +            "/map[@name='TestKey5']/beans[2]/int",
  +            new Integer(1),
  +            "/map[@name='TestKey5']/beans[2]/int");
       }
  -    
  +
       /**
        * Test JXPath.iterate() with map containing an array
        */
  -    public void testIterateArray(){
  +    public void testIterateArray() {
           Map map = new HashMap();
  -        map.put("foo", new String[]{"a", "b", "c"});
  +        map.put("foo", new String[] { "a", "b", "c" });
   
           JXPathContext context = JXPathContext.newContext(map);
   
  -        assertXPathValueIterator(context,
  -            "foo",
  -            list("a", "b", "c"));
  +        assertXPathValueIterator(context, "foo", list("a", "b", "c"));
       }
   
  -    public void testIteratePointersArray(){
  +    public void testIteratePointersArray() {
           Map map = new HashMap();
  -        map.put("foo", new String[]{"a", "b", "c"});
  +        map.put("foo", new String[] { "a", "b", "c" });
   
           JXPathContext context = JXPathContext.newContext(map);
   
           Iterator it = context.iteratePointers("foo");
           List actual = new ArrayList();
  -        while (it.hasNext()){
  -            Pointer ptr = (Pointer)it.next();
  +        while (it.hasNext()) {
  +            Pointer ptr = (Pointer) it.next();
               actual.add(context.getValue(ptr.asPath()));
           }
  -        assertEquals("Iterating pointers <" + "foo" + ">",
  -                list("a", "b", "c"), actual);
  +        assertEquals(
  +            "Iterating pointers <" + "foo" + ">",
  +            list("a", "b", "c"),
  +            actual);
       }
   
  -    public void testIteratePointersArrayElementWithVariable(){
  +    public void testIteratePointersArrayElementWithVariable() {
           Map map = new HashMap();
  -        map.put("foo", new String[]{"a", "b", "c"});
  +        map.put("foo", new String[] { "a", "b", "c" });
   
           JXPathContext context = JXPathContext.newContext(map);
           context.getVariables().declareVariable("x", new Integer(2));
           Iterator it = context.iteratePointers("foo[$x]");
           List actual = new ArrayList();
  -        while (it.hasNext()){
  -            Pointer ptr = (Pointer)it.next();
  +        while (it.hasNext()) {
  +            Pointer ptr = (Pointer) it.next();
               actual.add(context.getValue(ptr.asPath()));
           }
           assertEquals("Iterating pointers <" + "foo" + ">", list("b"), actual);
       }
   
  -    public void testIterateVector(){
  +    public void testIterateVector() {
           Map map = new HashMap();
           Vector vec = new Vector();
           vec.add(new HashMap());
  @@ -470,64 +473,69 @@
   
           map.put("vec", vec);
           JXPathContext context = JXPathContext.newContext(map);
  -        assertXPathPointerIterator(context,
  +        assertXPathPointerIterator(
  +            context,
               "/vec",
               list("/.[@name='vec'][1]", "/.[@name='vec'][2]"));
       }
  -    
  -    public void testErrorProperty(){
  +
  +    public void testErrorProperty() {
           context.getVariables().declareVariable(
               "e",
               new ExceptionPropertyTestBean());
  -         
  -        boolean ex = false;   
  +
  +        boolean ex = false;
           try {
               assertXPathValue(context, "$e/errorString", null);
           }
  -        catch (Throwable t){
  +        catch (Throwable t) {
               ex = true;
           }
           assertTrue("Legitimate exception accessing property", ex);
  -        
  -        assertXPathPointer(context, 
  -            "$e/errorString", 
  -            "$e/errorString");
   
  -        assertXPathPointerLenient(context,
  +        assertXPathPointer(context, "$e/errorString", "$e/errorString");
  +
  +        assertXPathPointerLenient(
  +            context,
               "$e/errorStringArray[1]",
               "$e/errorStringArray[1]");
  -            
  -        assertXPathPointerIterator(context,
  +
  +        assertXPathPointerIterator(
  +            context,
               "$e/errorString",
               list("$e/errorString"));
   
  -        assertXPathPointerIterator(context,
  +        assertXPathPointerIterator(
  +            context,
               "$e//error",
               Collections.EMPTY_LIST);
       }
  -    
  -    public void testMatrix(){
  -        assertXPathValueAndPointer(context,
  -               "$matrix[1]/.[1]",
  -               new Integer(3),
  -               "$matrix[1]/.[1]");
  -                
  +
  +    public void testMatrix() {
  +        assertXPathValueAndPointer(
  +            context,
  +            "$matrix[1]/.[1]",
  +            new Integer(3),
  +            "$matrix[1]/.[1]");
  +
           context.setValue("$matrix[1]/.[1]", new Integer(2));
   
  -        assertXPathValueAndPointer(context,
  -              "matrix[1]/.[1]",
  -              new Integer(3),
  -              "/matrix[1]/.[1]");
  -                
  +        assertXPathValueAndPointer(
  +            context,
  +            "matrix[1]/.[1]",
  +            new Integer(3),
  +            "/matrix[1]/.[1]");
  +
           context.setValue("matrix[1]/.[1]", "2");
  -      
  +
           assertXPathValue(context, "matrix[1]/.[1]", new Integer(2));
  -      
  +
           context.getVariables().declareVariable(
               "wholebean",
               context.getContextBean());
  -            
  -        assertXPathValueAndPointer(context,
  +
  +        assertXPathValueAndPointer(
  +            context,
               "$wholebean/matrix[1]/.[1]",
               new Integer(2),
               "$wholebean/matrix[1]/.[1]");
  @@ -536,30 +544,31 @@
           try {
               context.setValue("$wholebean/matrix[1]/.[2]", "4");
           }
  -        catch (Exception e){
  +        catch (Exception e) {
               ex = true;
  -        }        
  +        }
           assertTrue("Exception setting value of non-existent element", ex);
  -        
  +
           ex = false;
           try {
               context.setValue("$wholebean/matrix[2]/.[1]", "4");
           }
  -        catch (Exception e){
  +        catch (Exception e) {
               ex = true;
  -        }        
  +        }
           assertTrue("Exception setting value of non-existent element", ex);
       }
  -    
  -    public void testCreatePathAndSetValueWithMatrix(){
  -        
  +
  +    public void testCreatePathAndSetValueWithMatrix() {
  +
           context.setValue("matrix", null);
  -        
  +
           // Calls factory.createObject(..., TestMixedModelBean, "matrix")
           // Calls factory.createObject(..., nestedBean, "strings", 2)
  -        assertXPathCreatePathAndSetValue(context,
  -                "/matrix[1]/.[1]",
  -                new Integer(4),
  -                "/matrix[1]/.[1]");        
  -    }    
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/matrix[1]/.[1]",
  +            new Integer(4),
  +            "/matrix[1]/.[1]");
  +    }
   }
  
  
  
  1.4       +26 -15    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/TestMixedModelFactory.java
  
  Index: TestMixedModelFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/TestMixedModelFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TestMixedModelFactory.java	11 Jan 2003 05:41:27 -0000	1.3
  +++ TestMixedModelFactory.java	20 Jan 2003 00:00:28 -0000	1.4
  @@ -65,7 +65,12 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -import org.apache.commons.jxpath.*;
  +import org.apache.commons.jxpath.AbstractFactory;
  +import org.apache.commons.jxpath.JXPathContext;
  +import org.apache.commons.jxpath.NestedTestBean;
  +import org.apache.commons.jxpath.Pointer;
  +import org.apache.commons.jxpath.TestBean;
  +import org.apache.commons.jxpath.TestMixedModelBean;
   
   /**
    * Test AbstractFactory.
  @@ -79,41 +84,47 @@
        * Create a new instance and put it in the collection on the parent object.
        * Return <b>false</b> if this factory cannot create the requested object.
        */
  -    public boolean createObject(JXPathContext context, Pointer pointer, Object parent, String name, int index){
  -        if (name.equals("nestedBean")){
  -            ((TestBean)parent).setNestedBean(new NestedTestBean("newName"));
  +    public boolean createObject(
  +        JXPathContext context,
  +        Pointer pointer,
  +        Object parent,
  +        String name,
  +        int index) 
  +    {
  +        if (name.equals("nestedBean")) {
  +            ((TestBean) parent).setNestedBean(new NestedTestBean("newName"));
               return true;
           }
  -        else if (name.equals("beans")){
  -            TestBean bean = (TestBean)parent;
  -            if (bean.getBeans() == null || index >= bean.getBeans().length){
  +        else if (name.equals("beans")) {
  +            TestBean bean = (TestBean) parent;
  +            if (bean.getBeans() == null || index >= bean.getBeans().length) {
                   bean.setBeans(new NestedTestBean[index + 1]);
               }
               bean.getBeans()[index] = new NestedTestBean("newName");
               return true;
           }
  -        else if (name.equals("map")){
  -            ((TestBean)parent).setMap(new HashMap());
  +        else if (name.equals("map")) {
  +            ((TestBean) parent).setMap(new HashMap());
               return true;
           }
  -        else if (name.equals("TestKey5")){
  +        else if (name.equals("TestKey5")) {
               TestBean tb = new TestBean();
               tb.setNestedBean(null);
               tb.setBeans(null);
  -            ((Map)parent).put(name, tb);
  +            ((Map) parent).put(name, tb);
               return true;
           }
  -        else if (name.equals("matrix")){
  +        else if (name.equals("matrix")) {
               int[][] matrix = new int[2][];
               matrix[0] = new int[1];
  -//            matrix[1] = new int[2];
  -            ((TestMixedModelBean)parent).setMatrix(matrix);
  +            //            matrix[1] = new int[2];
  +             ((TestMixedModelBean) parent).setMatrix(matrix);
               return true;
           }
           return false;
       }
   
  -    public boolean declareVariable(JXPathContext context, String name){
  +    public boolean declareVariable(JXPathContext context, String name) {
           return false;
       }
   }
  
  
  
  1.9       +427 -395  jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java
  
  Index: XMLModelTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XMLModelTestCase.java	12 Jan 2003 05:21:50 -0000	1.8
  +++ XMLModelTestCase.java	20 Jan 2003 00:00:28 -0000	1.9
  @@ -79,8 +79,7 @@
    * @version $Revision$ $Date$
    */
   
  -public abstract class XMLModelTestCase extends JXPathTestCase
  -{
  +public abstract class XMLModelTestCase extends JXPathTestCase {
       private JXPathContext context;
   
       /**
  @@ -88,35 +87,36 @@
        *
        * @param name Name of the test case
        */
  -    public XMLModelTestCase(String name){
  +    public XMLModelTestCase(String name) {
           super(name);
       }
   
  -    public void setUp(){
  -        if (context == null){
  +    public void setUp() {
  +        if (context == null) {
               DocumentContainer docCtr = createDocumentContainer();
               context = createContext();
               Variables vars = context.getVariables();
               vars.declareVariable("document", docCtr.getValue());
               vars.declareVariable("container", docCtr);
  -            vars.declareVariable("element", 
  -            context.getPointer("vendor/location/address/street").getNode());
  +            vars.declareVariable(
  +                "element",
  +                context.getPointer("vendor/location/address/street").getNode());
           }
       }
   
       protected abstract String getModel();
   
  -    protected DocumentContainer createDocumentContainer(){
  +    protected DocumentContainer createDocumentContainer() {
           return new DocumentContainer(
  -                JXPathTestCase.class.getResource("Vendor.xml"),
  -                getModel());
  +            JXPathTestCase.class.getResource("Vendor.xml"),
  +            getModel());
       }
  -    
  +
       protected abstract AbstractFactory getAbstractFactory();
   
  -    protected JXPathContext createContext(){
  +    protected JXPathContext createContext() {
           JXPathContext context =
  -                JXPathContext.newContext(createDocumentContainer());
  +            JXPathContext.newContext(createDocumentContainer());
           context.setFactory(getAbstractFactory());
           return context;
       }
  @@ -125,599 +125,631 @@
        * An XML signature is used to determine if we have the right result
        * after a modification of XML by JXPath.  It is basically a piece
        * of simplified XML.
  -     */    
  -    protected abstract String getXMLSignature(Object node, 
  -            boolean elements, boolean attributes, boolean text, boolean pi);
  -
  -    protected void assertXMLSignature(JXPathContext context,
  -            String path, String signature,
  -            boolean elements, boolean attributes, boolean text, boolean pi)
  +     */
  +    protected abstract String getXMLSignature(
  +        Object node,
  +        boolean elements,
  +        boolean attributes,
  +        boolean text,
  +        boolean pi);
  +
  +    protected void assertXMLSignature(
  +        JXPathContext context,
  +        String path,
  +        String signature,
  +        boolean elements,
  +        boolean attributes,
  +        boolean text,
  +        boolean pi) 
       {
           Object node = context.getPointer(path).getNode();
           String sig = getXMLSignature(node, elements, attributes, text, pi);
           assertEquals("XML Signature mismatch: ", signature, sig);
       }
  -    
  +
       // ------------------------------------------------ Individual Test Methods
   
  -    public void testDocumentOrder(){
  -        assertDocumentOrder(context, 
  -                "vendor/location", 
  -                "vendor/location/address/street", 
  -                -1);
  -                
  -        assertDocumentOrder(context, 
  -                "vendor/location[@id = '100']", 
  -                "vendor/location[@id = '101']", 
  -                -1);
  -                
  -        assertDocumentOrder(context, 
  -                "vendor//price:amount", 
  -                "vendor/location", 
  -                1);
  -    }
  -
  -    public void testSetValue(){
  -        assertXPathSetValue(context,
  -                "vendor/location[@id = '100']",
  -                "New Text");
  -        
  -        assertXMLSignature(context,
  -                "vendor/location[@id = '100']",
  -                "<E>New Text</E>",
  -                false, false, true, false);
  -                
  -        assertXPathSetValue(context,
  -                "vendor/location[@id = '101']",
  -                "Replacement Text");
  -
  -        assertXMLSignature(context,
  -                "vendor/location[@id = '101']",
  -                "<E>Replacement Text</E>",
  -                false, false, true, false);                
  +    public void testDocumentOrder() {
  +        assertDocumentOrder(
  +            context,
  +            "vendor/location",
  +            "vendor/location/address/street",
  +            -1);
  +
  +        assertDocumentOrder(
  +            context,
  +            "vendor/location[@id = '100']",
  +            "vendor/location[@id = '101']",
  +            -1);
  +
  +        assertDocumentOrder(
  +            context,
  +            "vendor//price:amount",
  +            "vendor/location",
  +            1);
  +    }
  +
  +    public void testSetValue() {
  +        assertXPathSetValue(
  +            context,
  +            "vendor/location[@id = '100']",
  +            "New Text");
  +
  +        assertXMLSignature(
  +            context,
  +            "vendor/location[@id = '100']",
  +            "<E>New Text</E>",
  +            false,
  +            false,
  +            true,
  +            false);
  +
  +        assertXPathSetValue(
  +            context,
  +            "vendor/location[@id = '101']",
  +            "Replacement Text");
  +
  +        assertXMLSignature(
  +            context,
  +            "vendor/location[@id = '101']",
  +            "<E>Replacement Text</E>",
  +            false,
  +            false,
  +            true,
  +            false);
       }
  -    
  +
       /**
        * Test JXPathContext.createPath() with various arguments
        */
  -    public void testCreatePath(){
  +    public void testCreatePath() {
           // Create a DOM element
  -        assertXPathCreatePath(context, 
  -                "/vendor[1]/location[3]", 
  -                "",
  -                "/vendor[1]/location[3]");
  +        assertXPathCreatePath(
  +            context,
  +            "/vendor[1]/location[3]",
  +            "",
  +            "/vendor[1]/location[3]");
   
           // Create a DOM element with contents
  -        assertXPathCreatePath(context, 
  -                "/vendor[1]/location[3]/address/street", 
  -                "",
  -                "/vendor[1]/location[3]/address[1]/street[1]");
  +        assertXPathCreatePath(
  +            context,
  +            "/vendor[1]/location[3]/address/street",
  +            "",
  +            "/vendor[1]/location[3]/address[1]/street[1]");
   
           // Create a DOM attribute
  -        assertXPathCreatePath(context, 
  -                "/vendor[1]/location[2]/@manager", 
  -                "",
  -                "/vendor[1]/location[2]/@manager");
  -
  -        assertXPathCreatePath(context, 
  -                "/vendor[1]/location[1]/@name", 
  -                "local",
  -                "/vendor[1]/location[1]/@name");
  +        assertXPathCreatePath(
  +            context,
  +            "/vendor[1]/location[2]/@manager",
  +            "",
  +            "/vendor[1]/location[2]/@manager");
  +
  +        assertXPathCreatePath(
  +            context,
  +            "/vendor[1]/location[1]/@name",
  +            "local",
  +            "/vendor[1]/location[1]/@name");
       }
   
  -
       /**
        * Test JXPath.createPathAndSetValue() with various arguments
        */
  -    public void testCreatePathAndSetValue(){
  +    public void testCreatePathAndSetValue() {
           // Create a XML element
  -        assertXPathCreatePathAndSetValue(context, 
  -                "vendor/location[3]", 
  -                "",
  -                "/vendor[1]/location[3]");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "vendor/location[3]",
  +            "",
  +            "/vendor[1]/location[3]");
   
           // Create a DOM element with contents
  -        assertXPathCreatePathAndSetValue(context, 
  -                "vendor/location[3]/address/street", 
  -                "Lemon Circle",
  -                "/vendor[1]/location[3]/address[1]/street[1]");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "vendor/location[3]/address/street",
  +            "Lemon Circle",
  +            "/vendor[1]/location[3]/address[1]/street[1]");
   
           // Create an attribute
  -        assertXPathCreatePathAndSetValue(context, 
  -                "vendor/location[2]/@manager", 
  -                "John Doe",
  -                "/vendor[1]/location[2]/@manager");
  -                
  -        assertXPathCreatePathAndSetValue(context,
  -                "vendor/location[1]/@manager", 
  -                "John Doe",
  -                "/vendor[1]/location[1]/@manager");
  -
  -        assertXPathCreatePathAndSetValue(context, 
  -                "vendor/product/name/attribute::price:language", 
  -                "English",
  -                "/vendor[1]/product[1]/name[1]/@price:language");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "vendor/location[2]/@manager",
  +            "John Doe",
  +            "/vendor[1]/location[2]/@manager");
  +
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "vendor/location[1]/@manager",
  +            "John Doe",
  +            "/vendor[1]/location[1]/@manager");
  +
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "vendor/product/name/attribute::price:language",
  +            "English",
  +            "/vendor[1]/product[1]/name[1]/@price:language");
       }
   
       /**
        * Test JXPathContext.removePath() with various arguments
        */
  -    public void testRemovePath(){
  +    public void testRemovePath() {
           // Remove XML nodes
           context.removePath("vendor/location[@id = '101']//street/text()");
  -        assertEquals("Remove DOM text", "",
  -                    context.getValue("vendor/location[@id = '101']//street"));
  +        assertEquals(
  +            "Remove DOM text",
  +            "",
  +            context.getValue("vendor/location[@id = '101']//street"));
   
           context.removePath("vendor/location[@id = '101']//street");
  -        assertEquals("Remove DOM element", new Double(0),
  -                    context.getValue("count(vendor/location[@id = '101']//street)"));
  +        assertEquals(
  +            "Remove DOM element",
  +            new Double(0),
  +            context.getValue("count(vendor/location[@id = '101']//street)"));
   
           context.removePath("vendor/location[@id = '100']/@name");
  -        assertEquals("Remove DOM attribute", new Double(0),
  -                    context.getValue("count(vendor/location[@id = '100']/@name)"));
  +        assertEquals(
  +            "Remove DOM attribute",
  +            new Double(0),
  +            context.getValue("count(vendor/location[@id = '100']/@name)"));
       }
   
  -    public void testID(){
  -        context.setIdentityManager(new IdentityManager(){
  -            public Pointer getPointerByID(JXPathContext context, String id){
  -                NodePointer ptr = (NodePointer)context.getPointer("/");
  -                ptr = ptr.getValuePointer();        // Unwrap the container
  +    public void testID() {
  +        context.setIdentityManager(new IdentityManager() {
  +            public Pointer getPointerByID(JXPathContext context, String id) {
  +                NodePointer ptr = (NodePointer) context.getPointer("/");
  +                ptr = ptr.getValuePointer(); // Unwrap the container
                   return ptr.getPointerByID(context, id);
               }
           });
   
  -        assertXPathValueAndPointer(context,
  -                "id(101)//street",
  -                "Tangerine Drive",
  -                "id('101')/address[1]/street[1]");
  -
  -        assertXPathPointerLenient(context,
  -                "id(105)/address/street",
  -                "id(105)/address/street");
  +        assertXPathValueAndPointer(
  +            context,
  +            "id(101)//street",
  +            "Tangerine Drive",
  +            "id('101')/address[1]/street[1]");
  +
  +        assertXPathPointerLenient(
  +            context,
  +            "id(105)/address/street",
  +            "id(105)/address/street");
       }
   
       public void testAxisChild() {
  -        assertXPathValue(context,
  -                "vendor/location/address/street",
  -                "Orchard Road");
  +        assertXPathValue(
  +            context,
  +            "vendor/location/address/street",
  +            "Orchard Road");
   
           // child:: - first child does not match, need to search
  -        assertXPathValue(context,
  -                "vendor/location/address/city",
  -                "Fruit Market");
  +        assertXPathValue(
  +            context,
  +            "vendor/location/address/city",
  +            "Fruit Market");
           // local-name(qualified)
  -        assertXPathValue(context,
  -                "local-name(vendor/product/price:amount)",
  -                "amount");
  +        assertXPathValue(
  +            context,
  +            "local-name(vendor/product/price:amount)",
  +            "amount");
   
           // local-name(non-qualified)
  -        assertXPathValue(context,
  -                "local-name(vendor/location)",
  -                "location");
  +        assertXPathValue(context, "local-name(vendor/location)", "location");
   
           // name (qualified)
  -        assertXPathValue(context,
  -                "name(vendor/product/price:amount)",
  -                "priceNS:amount");
  +        assertXPathValue(
  +            context,
  +            "name(vendor/product/price:amount)",
  +            "priceNS:amount");
   
           // name (non-qualified)
  -        assertXPathValue(context,
  -                "name(vendor/location)",
  -                "location");
  +        assertXPathValue(context, "name(vendor/location)", "location");
   
           // namespace-uri (qualified)
  -        assertXPathValue(context,
  -                "namespace-uri(vendor/product/price:amount)",
  -                "priceNS");
  +        assertXPathValue(
  +            context,
  +            "namespace-uri(vendor/product/price:amount)",
  +            "priceNS");
   
           // default namespace does not affect search
  -        assertXPathValue(context,
  -                "vendor/product/prix",
  -                "934.99");
  +        assertXPathValue(context, "vendor/product/prix", "934.99");
   
           // child:: with a wildcard
  -        assertXPathValue(context,
  -                "count(vendor/product/price:*)",
  -                new Double(2));
  +        assertXPathValue(
  +            context,
  +            "count(vendor/product/price:*)",
  +            new Double(2));
   
           // child:: with a namespace and wildcard
  -        assertXPathValue(context,
  -                "count(vendor/product/value:*)",
  -                new Double(2));
  +        assertXPathValue(
  +            context,
  +            "count(vendor/product/value:*)",
  +            new Double(2));
   
           // child:: with the default namespace
  -        assertXPathValue(context,
  -                "count(vendor/product/*)",
  -                new Double(4));
  +        assertXPathValue(context, "count(vendor/product/*)", new Double(4));
   
           // child:: with a qualified name
  -        assertXPathValue(context,
  -                "vendor/product/price:amount",
  -                "45.95");
  +        assertXPathValue(context, "vendor/product/price:amount", "45.95");
       }
   
       public void testAxisChildIndexPredicate() {
  -        assertXPathValue(context,
  -                "vendor/location[2]/address/street",
  -                "Tangerine Drive");
  +        assertXPathValue(
  +            context,
  +            "vendor/location[2]/address/street",
  +            "Tangerine Drive");
       }
   
       public void testAxisDescendant() {
           // descendant::
  -        assertXPathValue(context,
  -                "//street",
  -                "Orchard Road");
  +        assertXPathValue(context, "//street", "Orchard Road");
   
           // descendent:: with a namespace and wildcard
  -        assertXPathValue(context,
  -                "count(//price:*)",
  -                new Double(2));
  -                
  -        assertXPathValueIterator(context,
  -                "vendor//saleEnds",
  -                list("never"));
  -
  -        assertXPathValueIterator(context,
  -                "vendor//promotion",
  -                list(""));
  -
  -        assertXPathValueIterator(context,
  -                "vendor//saleEnds[../@stores = 'all']",
  -                list("never"));
  -
  -        assertXPathValueIterator(context,
  -                "vendor//promotion[../@stores = 'all']",
  -                list(""));
  +        assertXPathValue(context, "count(//price:*)", new Double(2));
  +
  +        assertXPathValueIterator(context, "vendor//saleEnds", list("never"));
  +
  +        assertXPathValueIterator(context, "vendor//promotion", list(""));
  +
  +        assertXPathValueIterator(
  +            context,
  +            "vendor//saleEnds[../@stores = 'all']",
  +            list("never"));
  +
  +        assertXPathValueIterator(
  +            context,
  +            "vendor//promotion[../@stores = 'all']",
  +            list(""));
       }
  -    
  +
       public void testAxisParent() {
           // parent::
  -        assertXPathPointer(context,
  -                "//street/..",
  -                "/vendor[1]/location[1]/address[1]");
  +        assertXPathPointer(
  +            context,
  +            "//street/..",
  +            "/vendor[1]/location[1]/address[1]");
   
           // parent:: (note reverse document order)
  -        assertXPathPointerIterator(context,
  -                "//street/..",
  -                list("/vendor[1]/location[2]/address[1]",
  -                     "/vendor[1]/location[1]/address[1]"));
  +        assertXPathPointerIterator(
  +            context,
  +            "//street/..",
  +            list(
  +                "/vendor[1]/location[2]/address[1]",
  +                "/vendor[1]/location[1]/address[1]"));
   
           // parent:: with a namespace and wildcard
  -        assertXPathValue(context,
  -                "vendor/product/price:sale/saleEnds/parent::price:*" +
  -                        "/saleEnds",
  -                "never");
  +        assertXPathValue(
  +            context,
  +            "vendor/product/price:sale/saleEnds/parent::price:*" + "/saleEnds",
  +            "never");
       }
   
       public void testAxisFollowingSibling() {
           // following-sibling::
  -        assertXPathValue(context,
  -                "vendor/location[.//employeeCount = 10]/" +
  -                        "following-sibling::location//street",
  -                "Tangerine Drive");
  +        assertXPathValue(
  +            context,
  +            "vendor/location[.//employeeCount = 10]/"
  +                + "following-sibling::location//street",
  +            "Tangerine Drive");
   
           // following-sibling:: produces the correct pointer
  -        assertXPathPointer(context,
  -                "vendor/location[.//employeeCount = 10]/" +
  -                        "following-sibling::location//street",
  -                "/vendor[1]/location[2]/address[1]/street[1]");
  +        assertXPathPointer(
  +            context,
  +            "vendor/location[.//employeeCount = 10]/"
  +                + "following-sibling::location//street",
  +            "/vendor[1]/location[2]/address[1]/street[1]");
       }
   
       public void testAxisPrecedingSibling() {
           // preceding-sibling:: produces the correct pointer
  -        assertXPathPointer(context,
  -                "//location[2]/preceding-sibling::location//street",
  -                "/vendor[1]/location[1]/address[1]/street[1]");
  +        assertXPathPointer(
  +            context,
  +            "//location[2]/preceding-sibling::location//street",
  +            "/vendor[1]/location[1]/address[1]/street[1]");
       }
   
       public void testAxisAttribute() {
           // attribute::
  -        assertXPathValue(context,
  -                "vendor/location/@id",
  -                "100");
  +        assertXPathValue(context, "vendor/location/@id", "100");
   
           // attribute:: produces the correct pointer
  -        assertXPathPointer(context,
  -                "vendor/location/@id",
  -                "/vendor[1]/location[1]/@id");
  +        assertXPathPointer(
  +            context,
  +            "vendor/location/@id",
  +            "/vendor[1]/location[1]/@id");
   
           // iterate over attributes
  -        assertXPathValueIterator(context,
  -                "vendor/location/@id",
  -                list("100", "101"));
  +        assertXPathValueIterator(
  +            context,
  +            "vendor/location/@id",
  +            list("100", "101"));
   
           // Using different prefixes for the same namespace
  -        assertXPathValue(context,
  -                "vendor/product/price:amount/@price:discount",
  -                "10%");
  -        assertXPathValue(context,
  -                "vendor/product/value:amount/@value:discount",
  -                "10%");
  +        assertXPathValue(
  +            context,
  +            "vendor/product/price:amount/@price:discount",
  +            "10%");
  +        assertXPathValue(
  +            context,
  +            "vendor/product/value:amount/@value:discount",
  +            "10%");
   
           // namespace uri for an attribute
  -        assertXPathValue(context,
  -                "namespace-uri(vendor/product/price:amount/@price:discount)",
  -                "priceNS");
  +        assertXPathValue(
  +            context,
  +            "namespace-uri(vendor/product/price:amount/@price:discount)",
  +            "priceNS");
   
           // local name of an attribute
  -        assertXPathValue(context,
  -                "local-name(vendor/product/price:amount/@price:discount)",
  -                "discount");
  +        assertXPathValue(
  +            context,
  +            "local-name(vendor/product/price:amount/@price:discount)",
  +            "discount");
   
           // name for an attribute
  -        assertXPathValue(context,
  -                "name(vendor/product/price:amount/@price:discount)",
  -                "priceNS:discount");
  +        assertXPathValue(
  +            context,
  +            "name(vendor/product/price:amount/@price:discount)",
  +            "priceNS:discount");
   
           // attribute:: with the default namespace
  -        assertXPathValue(context,
  -                "vendor/product/price:amount/@discount",
  -                "20%");
  +        assertXPathValue(
  +            context,
  +            "vendor/product/price:amount/@discount",
  +            "20%");
   
           // namespace uri of an attribute with the default namespace
  -        assertXPathValue(context,
  -                "namespace-uri(vendor/product/price:amount/@discount)",
  -                "");
  +        assertXPathValue(
  +            context,
  +            "namespace-uri(vendor/product/price:amount/@discount)",
  +            "");
   
           // local name of an attribute with the default namespace
  -        assertXPathValue(context,
  -                "local-name(vendor/product/price:amount/@discount)",
  -                "discount");
  +        assertXPathValue(
  +            context,
  +            "local-name(vendor/product/price:amount/@discount)",
  +            "discount");
   
           // name of an attribute with the default namespace
  -        assertXPathValue(context,
  -                "name(vendor/product/price:amount/@discount)",
  -                "discount");
  +        assertXPathValue(
  +            context,
  +            "name(vendor/product/price:amount/@discount)",
  +            "discount");
   
           // attribute:: with a namespace and wildcard
  -        assertXPathValueIterator(context,
  -                "vendor/product/price:amount/@price:*",
  -                list("10%"));
  +        assertXPathValueIterator(
  +            context,
  +            "vendor/product/price:amount/@price:*",
  +            list("10%"));
   
           // attribute:: with a wildcard
  -        assertXPathValueIterator(context,
  -                "vendor/location[1]/@*",
  -                set("100", "", "local"));
  +        assertXPathValueIterator(
  +            context,
  +            "vendor/location[1]/@*",
  +            set("100", "", "local"));
   
           // attribute:: with default namespace and wildcard
  -        assertXPathValueIterator(context,
  -                "vendor/product/price:amount/@*",
  -                list("20%"));
  -
  +        assertXPathValueIterator(
  +            context,
  +            "vendor/product/price:amount/@*",
  +            list("20%"));
   
           // Empty attribute
  -        assertXPathValue(context,
  -                "vendor/location/@manager",
  -                "");
  +        assertXPathValue(context, "vendor/location/@manager", "");
   
           // Missing attribute
  -        assertXPathValueLenient(context,
  -                "vendor/location/@missing",
  -                null);
  +        assertXPathValueLenient(context, "vendor/location/@missing", null);
   
           // Missing attribute with namespace
  -        assertXPathValueLenient(context,
  -                "vendor/location/@miss:missing",
  -                null);
  -                
  +        assertXPathValueLenient(context, "vendor/location/@miss:missing", null);
  +
           // Using attribute in a predicate
  -        assertXPathValue(context,
  -                "vendor/location[@id='101']//street",
  -                "Tangerine Drive");
  +        assertXPathValue(
  +            context,
  +            "vendor/location[@id='101']//street",
  +            "Tangerine Drive");
       }
  -    
  +
       public void testAxisNamespace() {
           // namespace::
  -        assertXPathValueAndPointer(context,
  -                "vendor/product/prix/namespace::price",
  -                "priceNS",
  -                "/vendor[1]/product[1]/prix[1]/namespace::price");
  +        assertXPathValueAndPointer(
  +            context,
  +            "vendor/product/prix/namespace::price",
  +            "priceNS",
  +            "/vendor[1]/product[1]/prix[1]/namespace::price");
   
           // namespace::*
  -        assertXPathValue(context,
  -                "count(vendor/product/namespace::*)",
  -                new Double(3));
  +        assertXPathValue(
  +            context,
  +            "count(vendor/product/namespace::*)",
  +            new Double(3));
   
           // name of namespace
  -        assertXPathValue(context,
  -                "name(vendor/product/prix/namespace::price)",
  -                "priceNS:price");
  +        assertXPathValue(
  +            context,
  +            "name(vendor/product/prix/namespace::price)",
  +            "priceNS:price");
   
           // local name of namespace
  -        assertXPathValue(context,
  -                "local-name(vendor/product/prix/namespace::price)",
  -                "price");
  +        assertXPathValue(
  +            context,
  +            "local-name(vendor/product/prix/namespace::price)",
  +            "price");
       }
   
       public void testAxisAncestor() {
           // ancestor::
  -        assertXPathValue(context,
  -                "vendor/product/price:sale/saleEnds/" +
  -                        "ancestor::price:sale/saleEnds",
  -                "never");
  +        assertXPathValue(
  +            context,
  +            "vendor/product/price:sale/saleEnds/"
  +                + "ancestor::price:sale/saleEnds",
  +            "never");
   
           // ancestor:: with a wildcard
  -        assertXPathValue(context,
  -                "vendor/product/price:sale/saleEnds/ancestor::price:*" +
  -                        "/saleEnds",
  -                "never");
  +        assertXPathValue(
  +            context,
  +            "vendor/product/price:sale/saleEnds/ancestor::price:*"
  +                + "/saleEnds",
  +            "never");
       }
   
       public void testAxisAncestorOrSelf() {
           // ancestor-or-self::
  -        assertXPathValue(context,
  -                "vendor/product/price:sale/" +
  -                        "ancestor-or-self::price:sale/saleEnds",
  -                "never");
  +        assertXPathValue(
  +            context,
  +            "vendor/product/price:sale/"
  +                + "ancestor-or-self::price:sale/saleEnds",
  +            "never");
       }
   
       public void testAxisFollowing() {
  -        assertXPathValueIterator(context,
  -                "vendor/contact/following::location//street",
  -                list("Orchard Road", "Tangerine Drive"));
  +        assertXPathValueIterator(
  +            context,
  +            "vendor/contact/following::location//street",
  +            list("Orchard Road", "Tangerine Drive"));
   
           // following:: with a namespace
  -        assertXPathValue(context,
  -                "//location/following::price:sale/saleEnds",
  -                "never");
  +        assertXPathValue(
  +            context,
  +            "//location/following::price:sale/saleEnds",
  +            "never");
       }
   
       public void testAxisSelf() {
           // self:: with a namespace
  -        assertXPathValue(context,
  -                "//price:sale/self::price:sale/saleEnds",
  -                "never");
  +        assertXPathValue(
  +            context,
  +            "//price:sale/self::price:sale/saleEnds",
  +            "never");
   
           // self:: with an unmatching name
  -        assertXPathValueLenient(context,
  -                "//price:sale/self::x/saleEnds",
  -                null);
  +        assertXPathValueLenient(context, "//price:sale/self::x/saleEnds", null);
       }
   
       public void testNodeTypeComment() {
           // comment()
  -        assertXPathValue(context,
  -                "//product/comment()",
  -                "We are not buying this product, ever");
  +        assertXPathValue(
  +            context,
  +            "//product/comment()",
  +            "We are not buying this product, ever");
       }
   
       public void testNodeTypeText() {
           // text()
  -        assertXPathValue(context,
  -                "//product/text()[. != '']",
  -                "We love this product.");
  +        assertXPathValue(
  +            context,
  +            "//product/text()[. != '']",
  +            "We love this product.");
   
           // text() pointer
  -        assertXPathPointer(context,
  -                "//product/text()",
  -                "/vendor[1]/product[1]/text()[1]");
  +        assertXPathPointer(
  +            context,
  +            "//product/text()",
  +            "/vendor[1]/product[1]/text()[1]");
   
       }
   
       public void testNodeTypeProcessingInstruction() {
           // processing-instruction() without an argument
  -        assertXPathValue(context,
  -                "//product/processing-instruction()",
  -                "do not show anybody");
  +        assertXPathValue(
  +            context,
  +            "//product/processing-instruction()",
  +            "do not show anybody");
   
           // processing-instruction() with an argument
  -        assertXPathValue(context,
  -                "//product/processing-instruction('report')",
  -                "average only");
  +        assertXPathValue(
  +            context,
  +            "//product/processing-instruction('report')",
  +            "average only");
   
           // processing-instruction() pointer without an argument
  -        assertXPathPointer(context,
  -                "//product/processing-instruction('report')",
  -                "/vendor[1]/product[1]/processing-instruction('report')[1]");
  +        assertXPathPointer(
  +            context,
  +            "//product/processing-instruction('report')",
  +            "/vendor[1]/product[1]/processing-instruction('report')[1]");
   
           // processing-instruction name
  -        assertXPathValue(context,
  -                "name(//product/processing-instruction()[1])",
  -                "security");
  +        assertXPathValue(
  +            context,
  +            "name(//product/processing-instruction()[1])",
  +            "security");
       }
   
       public void testLang() {
           // xml:lang built-in attribute
  -        assertXPathValue(context,
  -                "//product/prix/@xml:lang",
  -                "fr");
  +        assertXPathValue(context, "//product/prix/@xml:lang", "fr");
   
           // lang() used the built-in xml:lang attribute
  -        assertXPathValue(context,
  -                "//product/prix[lang('fr')]",
  -                "934.99");
  +        assertXPathValue(context, "//product/prix[lang('fr')]", "934.99");
   
           // Default language
  -        assertXPathValue(context,
  -                "//product/price:sale[lang('en')]/saleEnds",
  -                "never");
  +        assertXPathValue(
  +            context,
  +            "//product/price:sale[lang('en')]/saleEnds",
  +            "never");
       }
   
       public void testDocument() {
  -        assertXPathValue(context,
  -                "$document/vendor/location[1]//street",
  -                "Orchard Road");
  -
  -        assertXPathPointer(context,
  -                "$document/vendor/location[1]//street",
  -                "$document/vendor[1]/location[1]/address[1]/street[1]");
  -
  -        assertXPathValue(context,
  -                "$document/vendor//street",
  -                "Orchard Road");
  +        assertXPathValue(
  +            context,
  +            "$document/vendor/location[1]//street",
  +            "Orchard Road");
  +
  +        assertXPathPointer(
  +            context,
  +            "$document/vendor/location[1]//street",
  +            "$document/vendor[1]/location[1]/address[1]/street[1]");
  +
  +        assertXPathValue(context, "$document/vendor//street", "Orchard Road");
       }
   
       public void testContainer() {
  -        assertXPathValue(context,
  -                "$container/vendor//street",
  -                "Orchard Road");
  -
  -        assertXPathValue(context,
  -                "$container//street",
  -                "Orchard Road");
  -
  -        assertXPathPointer(context,
  -                "$container//street",
  -                "$container/vendor[1]/location[1]/address[1]/street[1]");
  +        assertXPathValue(context, "$container/vendor//street", "Orchard Road");
  +
  +        assertXPathValue(context, "$container//street", "Orchard Road");
  +
  +        assertXPathPointer(
  +            context,
  +            "$container//street",
  +            "$container/vendor[1]/location[1]/address[1]/street[1]");
   
           // Conversion to number
  -        assertXPathValue(context,
  -                "number(vendor/location/employeeCount)",
  -                new Double(10));
  +        assertXPathValue(
  +            context,
  +            "number(vendor/location/employeeCount)",
  +            new Double(10));
       }
  -    
  +
       public void testElementInVariable() {
  -        assertXPathValue(context,
  -                "$element",
  -                "Orchard Road");                
  +        assertXPathValue(context, "$element", "Orchard Road");
       }
   
       public void testTypeConversions() {
           // Implicit conversion to number
  -        assertXPathValue(context,
  -                "vendor/location/employeeCount + 1",
  -                new Double(11));
  +        assertXPathValue(
  +            context,
  +            "vendor/location/employeeCount + 1",
  +            new Double(11));
   
           // Implicit conversion to boolean
  -        assertXPathValue(context,
  -                "vendor/location/employeeCount and true()",
  -                Boolean.TRUE);
  -    }
  -    
  -    public void testBooleanFunction(){
  -        assertXPathValue(context,
  +        assertXPathValue(
  +            context,
  +            "vendor/location/employeeCount and true()",
  +            Boolean.TRUE);
  +    }
  +
  +    public void testBooleanFunction() {
  +        assertXPathValue(
  +            context,
               "boolean(vendor//saleEnds[../@stores = 'all'])",
               Boolean.TRUE);
   
  -        assertXPathValue(context,
  +        assertXPathValue(
  +            context,
               "boolean(vendor//promotion[../@stores = 'all'])",
               Boolean.TRUE);
   
  -        assertXPathValue(context,
  +        assertXPathValue(
  +            context,
               "boolean(vendor//promotion[../@stores = 'some'])",
               Boolean.FALSE);
  -     }    
  -     
  -    public void testBooleanPredicateWithSearch(){
  -        
  -        assertXPathValueIterator(context,
  -            "/vendor/inventory[department/count < 10]/name",
  -            list("Watermelon")
  -        );
  -
  -        assertXPathValueIterator(context,
  -            "/vendor/inventory[department/count >= 100]/name",
  -            list("Cantaloupe")
  -        );
  -
  -        assertXPathValueIterator(context,
  -            "/vendor/inventory[department/count = 3]/name",
  -            list("Watermelon")
  -        );
  -        
  -        assertXPathValueIterator(context,
  -            "/vendor/inventory[department/count != 3]/name",
  -            list("Cantaloupe")
  -        );
  -    }     
  +    }
   }
  
  
  
  1.3       +9 -10     jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/beans/BeanModelTest.java
  
  Index: BeanModelTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/beans/BeanModelTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BeanModelTest.java	26 Nov 2002 01:20:08 -0000	1.2
  +++ BeanModelTest.java	20 Jan 2003 00:00:28 -0000	1.3
  @@ -75,29 +75,28 @@
    * @version $Revision$ $Date$
    */
   
  -public class BeanModelTest extends BeanModelTestCase
  -{
  +public class BeanModelTest extends BeanModelTestCase {
       /**
        * Construct a new instance of this test case.
        *
        * @param name Name of the test case
        */
  -    public BeanModelTest(String name){
  +    public BeanModelTest(String name) {
           super(name);
       }
   
       /**
        * Return the tests included in this test suite.
        */
  -    public static TestSuite suite(){
  +    public static TestSuite suite() {
           return (new TestSuite(BeanModelTest.class));
       }
   
  -    protected Object createContextBean(){
  +    protected Object createContextBean() {
           return new TestBean();
       }
   
  -    protected AbstractFactory getAbstractFactory(){
  +    protected AbstractFactory getAbstractFactory() {
           return new TestBeanFactory();
       }
   
  
  
  
  1.5       +14 -6     jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/beans/TestBeanFactory.java
  
  Index: TestBeanFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/beans/TestBeanFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestBeanFactory.java	11 Jan 2003 05:41:27 -0000	1.4
  +++ TestBeanFactory.java	20 Jan 2003 00:00:28 -0000	1.5
  @@ -62,7 +62,11 @@
   
   package org.apache.commons.jxpath.ri.model.beans;
   
  -import org.apache.commons.jxpath.*;
  +import org.apache.commons.jxpath.AbstractFactory;
  +import org.apache.commons.jxpath.JXPathContext;
  +import org.apache.commons.jxpath.NestedTestBean;
  +import org.apache.commons.jxpath.Pointer;
  +import org.apache.commons.jxpath.TestBean;
   
   /**
    * Test AbstractFactory.
  @@ -75,8 +79,12 @@
       /**
        * Return <b>false</b> if this factory cannot create the requested object.
        */
  -    public boolean createObject(JXPathContext context, 
  -                Pointer pointer, Object parent, String name, int index)
  +    public boolean createObject(
  +        JXPathContext context,
  +        Pointer pointer,
  +        Object parent,
  +        String name,
  +        int index) 
       {
           if (name.equals("nestedBean")) {
               ((TestBean) parent).setNestedBean(new NestedTestBean("newName"));
  @@ -90,9 +98,9 @@
               bean.getBeans()[index] = new NestedTestBean("newName");
               return true;
           }
  -        else if (name.equals("integers")){    
  +        else if (name.equals("integers")) {
               // This will implicitly expand the collection        
  -            ((TestBean)parent).setIntegers(index, 0);
  +             ((TestBean) parent).setIntegers(index, 0);
               return true;
           }
           return false;
  @@ -101,7 +109,7 @@
       /**
        * Create a new object and set it on the specified variable
        */
  -    public boolean declareVariable(JXPathContext context, String name){
  +    public boolean declareVariable(JXPathContext context, String name) {
           return false;
       }
   }
  
  
  
  1.6       +69 -39    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dom/DOMModelTest.java
  
  Index: DOMModelTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dom/DOMModelTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DOMModelTest.java	26 Nov 2002 01:33:35 -0000	1.5
  +++ DOMModelTest.java	20 Jan 2003 00:00:29 -0000	1.6
  @@ -79,66 +79,86 @@
    * @version $Revision$ $Date$
    */
   
  -public class DOMModelTest extends XMLModelTestCase
  -{
  +public class DOMModelTest extends XMLModelTestCase {
       /**
        * Construct a new instance of this test case.
        *
        * @param name Name of the test case
        */
  -    public DOMModelTest(String name){
  +    public DOMModelTest(String name) {
           super(name);
       }
  -    
  +
       /**
        * Return the tests included in this test suite.
        */
  -    public static Test suite(){
  +    public static Test suite() {
           return (new TestSuite(DOMModelTest.class));
       }
   
  -    protected String getModel(){
  +    protected String getModel() {
           return DocumentContainer.MODEL_DOM;
       }
  -    
  -    protected AbstractFactory getAbstractFactory(){
  +
  +    protected AbstractFactory getAbstractFactory() {
           return new TestDOMFactory();
       }
  -    
  -    protected String getXMLSignature(Object node, 
  -            boolean elements, boolean attributes, boolean text, boolean pi){
  +
  +    protected String getXMLSignature(
  +        Object node,
  +        boolean elements,
  +        boolean attributes,
  +        boolean text,
  +        boolean pi) 
  +    {
           StringBuffer buffer = new StringBuffer();
           appendXMLSignature(buffer, node, elements, attributes, text, pi);
           return buffer.toString();
       }
  -    
  -    private void appendXMLSignature(StringBuffer buffer, Object object, 
  -            boolean elements, boolean attributes, boolean text, boolean pi){
  -        Node node = (Node)object;
  +
  +    private void appendXMLSignature(
  +        StringBuffer buffer,
  +        Object object,
  +        boolean elements,
  +        boolean attributes,
  +        boolean text,
  +        boolean pi) 
  +    {
  +        Node node = (Node) object;
           int type = node.getNodeType();
  -        switch (type){
  -            case Node.DOCUMENT_NODE:
  +        switch (type) {
  +            case Node.DOCUMENT_NODE :
                   buffer.append("<D>");
  -                appendXMLSignature(buffer, node.getChildNodes(), 
  -                        elements, attributes, text, pi);
  +                appendXMLSignature(
  +                    buffer,
  +                    node.getChildNodes(),
  +                    elements,
  +                    attributes,
  +                    text,
  +                    pi);
                   buffer.append("</D");
                   break;
  -                
  -            case Node.ELEMENT_NODE:
  -                String tag = elements ? ((Element)node).getTagName() : "E";
  +
  +            case Node.ELEMENT_NODE :
  +                String tag = elements ? ((Element) node).getTagName() : "E";
                   buffer.append("<");
                   buffer.append(tag);
                   buffer.append(">");
  -                appendXMLSignature(buffer, node.getChildNodes(), 
  -                        elements, attributes, text, pi);
  +                appendXMLSignature(
  +                    buffer,
  +                    node.getChildNodes(),
  +                    elements,
  +                    attributes,
  +                    text,
  +                    pi);
                   buffer.append("</");
                   buffer.append(tag);
  -                buffer.append(">");                    
  +                buffer.append(">");
                   break;
  -                
  -            case Node.TEXT_NODE:
  -            case Node.CDATA_SECTION_NODE:
  -                if (text){
  +
  +            case Node.TEXT_NODE :
  +            case Node.CDATA_SECTION_NODE :
  +                if (text) {
                       String string = node.getNodeValue();
                       string = string.replace('\n', '=');
                       buffer.append(string);
  @@ -146,13 +166,23 @@
                   break;
           }
       }
  -    
  -    private void appendXMLSignature(StringBuffer buffer, NodeList children, 
  -            boolean elements, boolean attributes, boolean text, boolean pi)
  +
  +    private void appendXMLSignature(
  +        StringBuffer buffer,
  +        NodeList children,
  +        boolean elements,
  +        boolean attributes,
  +        boolean text,
  +        boolean pi) 
       {
  -        for (int i = 0; i < children.getLength(); i++){
  -            appendXMLSignature(buffer, children.item(i), 
  -                    elements, attributes, text, pi);
  +        for (int i = 0; i < children.getLength(); i++) {
  +            appendXMLSignature(
  +                buffer,
  +                children.item(i),
  +                elements,
  +                attributes,
  +                text,
  +                pi);
           }
       }
   }
  
  
  
  1.2       +19 -15    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dom/TestDOMFactory.java
  
  Index: TestDOMFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dom/TestDOMFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestDOMFactory.java	20 Oct 2002 03:48:22 -0000	1.1
  +++ TestDOMFactory.java	20 Jan 2003 00:00:29 -0000	1.2
  @@ -78,37 +78,41 @@
       /**
        * Return <b>false</b> if this factory cannot create the requested object.
        */
  -    public boolean createObject(JXPathContext context, 
  -                Pointer pointer, Object parent, String name, int index)
  +    public boolean createObject(
  +        JXPathContext context,
  +        Pointer pointer,
  +        Object parent,
  +        String name,
  +        int index) 
       {
  -        if (name.equals("location") || 
  -                name.equals("address") || 
  -                name.equals("street")){
  -            addDOMElement((Node)parent, index, name);
  +        if (name.equals("location")
  +            || name.equals("address")
  +            || name.equals("street")) {
  +            addDOMElement((Node) parent, index, name);
               return true;
           }
           return false;
       }
   
  -    private void addDOMElement(Node parent, int index, String tag){
  +    private void addDOMElement(Node parent, int index, String tag) {
           Node child = parent.getFirstChild();
           int count = 0;
  -        while (child != null){
  -            if (child.getNodeName().equals(tag)){
  +        while (child != null) {
  +            if (child.getNodeName().equals(tag)) {
                   count++;
               }
               child = child.getNextSibling();
           }
   
           // Keep inserting new elements until we have index + 1 of them
  -        while (count <= index){
  +        while (count <= index) {
               Node newElement = parent.getOwnerDocument().createElement(tag);
               parent.appendChild(newElement);
               count++;
           }
       }
   
  -    public boolean declareVariable(JXPathContext context, String name){
  +    public boolean declareVariable(JXPathContext context, String name) {
           return false;
       }
   }
  
  
  
  1.2       +14 -16    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynabeans/DynaBeanModelTest.java
  
  Index: DynaBeanModelTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynabeans/DynaBeanModelTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DynaBeanModelTest.java	20 Oct 2002 03:48:22 -0000	1.1
  +++ DynaBeanModelTest.java	20 Jan 2003 00:00:29 -0000	1.2
  @@ -62,13 +62,13 @@
   
   package org.apache.commons.jxpath.ri.model.dynabeans;
   
  +import junit.framework.TestSuite;
  +
   import org.apache.commons.beanutils.WrapDynaBean;
   import org.apache.commons.jxpath.AbstractFactory;
   import org.apache.commons.jxpath.TestBean;
   import org.apache.commons.jxpath.ri.model.BeanModelTestCase;
   
  -import junit.framework.*;
  -
   /**
    * Test for support of DynaBeans (see BeanUtils)
    *
  @@ -76,25 +76,23 @@
    * @version $Revision$ $Date$
    */
   
  -public class DynaBeanModelTest extends BeanModelTestCase
  -{
  -    public DynaBeanModelTest(String name)
  -    {
  +public class DynaBeanModelTest extends BeanModelTestCase {
  +    public DynaBeanModelTest(String name) {
           super(name);
       }
   
  -    public static TestSuite suite(){
  -//        return (new TestSuite(BeanModelTest.class));
  -        TestSuite s = new TestSuite();
  -        s.addTest(new DynaBeanModelTest("testAxisParent"));
  -        return s;
  +    public static TestSuite suite() {
  +        return new TestSuite(DynaBeanModelTest.class);
  +//        TestSuite s = new TestSuite();
  +//        s.addTest(new DynaBeanModelTest("testAxisParent"));
  +//        return s;
       }
   
  -    protected Object createContextBean(){
  +    protected Object createContextBean() {
           return new WrapDynaBean(new TestBean());
       }
   
  -    protected AbstractFactory getAbstractFactory(){
  +    protected AbstractFactory getAbstractFactory() {
           return new TestDynaBeanFactory();
       }
   }
  
  
  
  1.5       +10 -8     jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynabeans/TestDynaBeanFactory.java
  
  Index: TestDynaBeanFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynabeans/TestDynaBeanFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestDynaBeanFactory.java	11 Jan 2003 05:41:27 -0000	1.4
  +++ TestDynaBeanFactory.java	20 Jan 2003 00:00:29 -0000	1.5
  @@ -63,7 +63,10 @@
   package org.apache.commons.jxpath.ri.model.dynabeans;
   
   import org.apache.commons.beanutils.DynaBean;
  -import org.apache.commons.jxpath.*;
  +import org.apache.commons.jxpath.AbstractFactory;
  +import org.apache.commons.jxpath.JXPathContext;
  +import org.apache.commons.jxpath.NestedTestBean;
  +import org.apache.commons.jxpath.Pointer;
   
   /**
    * Test AbstractFactory.
  @@ -76,11 +79,11 @@
       /**
        */
       public boolean createObject(
  -            JXPathContext context,
  -            Pointer pointer,
  -            Object parent,
  -            String name,
  -            int index) 
  +        JXPathContext context,
  +        Pointer pointer,
  +        Object parent,
  +        String name,
  +        int index) 
       {
           if (name.equals("nestedBean")) {
               ((DynaBean) parent).set(
  @@ -106,10 +109,9 @@
           return false;
       }
   
  -
       /**
        */
  -    public boolean declareVariable(JXPathContext context, String name){
  +    public boolean declareVariable(JXPathContext context, String name) {
           context.getVariables().declareVariable(name, null);
           return true;
       }
  
  
  
  1.2       +182 -185  jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynamic/DynamicPropertiesModelTest.java
  
  Index: DynamicPropertiesModelTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynamic/DynamicPropertiesModelTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DynamicPropertiesModelTest.java	28 Nov 2002 01:01:30 -0000	1.1
  +++ DynamicPropertiesModelTest.java	20 Jan 2003 00:00:29 -0000	1.2
  @@ -73,8 +73,7 @@
    * @version $Revision$ $Date$
    */
   
  -public class DynamicPropertiesModelTest extends JXPathTestCase
  -{
  +public class DynamicPropertiesModelTest extends JXPathTestCase {
       private static boolean enabled = true;
       private JXPathContext context;
   
  @@ -83,247 +82,245 @@
        *
        * @param name Name of the test case
        */
  -    public DynamicPropertiesModelTest(String name){
  +    public DynamicPropertiesModelTest(String name) {
           super(name);
       }
   
  -    public void setUp(){
  -        if (context == null){
  +    public void setUp() {
  +        if (context == null) {
               context = JXPathContext.newContext(new TestBean());
               context.setFactory(new TestDynamicPropertyFactory());
           }
       }
   
  -    public void testAxisChild(){
  -        assertXPathValue(context,
  -                "map/Key1",
  -                "Value 1");
  -
  -        assertXPathPointer(context,
  -                "map/Key1",
  -                "/map[@name='Key1']");
  -
  -        assertXPathValue(context,
  -                "map/Key2/name",
  -                "Name 6");
  -
  -        assertXPathPointer(context,
  -                "map/Key2/name",
  -                "/map[@name='Key2']/name");
  -    }
  -
  -    public void testAxisDescendant(){
  -        assertXPathValue(context,
  -                "//Key1",
  -                "Value 1");
  +    public void testAxisChild() {
  +        assertXPathValue(context, "map/Key1", "Value 1");
  +
  +        assertXPathPointer(context, "map/Key1", "/map[@name='Key1']");
  +
  +        assertXPathValue(context, "map/Key2/name", "Name 6");
  +
  +        assertXPathPointer(context, "map/Key2/name", "/map[@name='Key2']/name");
  +    }
  +
  +    public void testAxisDescendant() {
  +        assertXPathValue(context, "//Key1", "Value 1");
       }
   
       /**
        * Testing the pseudo-attribute "name" that dynamic property
        * objects appear to have.
        */
  -    public void testAttributeName(){
  -        assertXPathValue(context,
  -                "map[@name = 'Key1']",
  -                "Value 1");
  -
  -        assertXPathPointer(context,
  -                "map[@name = 'Key1']",
  -                "/map[@name='Key1']");
  -
  -        assertXPathPointerLenient(context,
  -                "map[@name = 'Key&quot;&apos;&quot;&apos;1']",
  -                "/map[@name='Key&quot;&apos;&quot;&apos;1']");
  -
  -        assertXPathValue(context,
  -                "/.[@name='map']/Key2/name",
  -                "Name 6");
  -
  -        assertXPathPointer(context,
  -                "/.[@name='map']/Key2/name",
  -                "/map[@name='Key2']/name");
  +    public void testAttributeName() {
  +        assertXPathValue(context, "map[@name = 'Key1']", "Value 1");
  +
  +        assertXPathPointer(
  +            context,
  +            "map[@name = 'Key1']",
  +            "/map[@name='Key1']");
  +
  +        assertXPathPointerLenient(
  +            context,
  +            "map[@name = 'Key&quot;&apos;&quot;&apos;1']",
  +            "/map[@name='Key&quot;&apos;&quot;&apos;1']");
  +
  +        assertXPathValue(context, "/.[@name='map']/Key2/name", "Name 6");
  +
  +        assertXPathPointer(
  +            context,
  +            "/.[@name='map']/Key2/name",
  +            "/map[@name='Key2']/name");
   
           // Bean in a map
  -        assertXPathValue(context,
  -                "/map[@name='Key2'][@name='name']",
  -                "Name 6");
  -
  -        assertXPathPointer(context,
  -                "/map[@name='Key2'][@name='name']",
  -                "/map[@name='Key2']/name");
  +        assertXPathValue(context, "/map[@name='Key2'][@name='name']", "Name 6");
  +
  +        assertXPathPointer(
  +            context,
  +            "/map[@name='Key2'][@name='name']",
  +            "/map[@name='Key2']/name");
   
           // Map in a bean in a map
  -        assertXPathValue(context,
  -                "/.[@name='map'][@name='Key2'][@name='name']",
  -                "Name 6");
  -
  -        assertXPathPointer(context,
  -                "/.[@name='map'][@name='Key2'][@name='name']",
  -                "/map[@name='Key2']/name");
  -    }
  -    
  -    public void testSetPrimitiveValue(){
  -        assertXPathSetValue(context, 
  -                "map/Key1",
  -                new Integer(6));
  +        assertXPathValue(
  +            context,
  +            "/.[@name='map'][@name='Key2'][@name='name']",
  +            "Name 6");
  +
  +        assertXPathPointer(
  +            context,
  +            "/.[@name='map'][@name='Key2'][@name='name']",
  +            "/map[@name='Key2']/name");
  +    }
  +
  +    public void testSetPrimitiveValue() {
  +        assertXPathSetValue(context, "map/Key1", new Integer(6));
       }
  -    
  -    public void testSetCollection(){
  +
  +    public void testSetCollection() {
           // See if we can assign a whole collection        
           context.setValue(
  -                "map/Key1", 
  -                new Integer[]{new Integer(7), new Integer(8)});
  -        
  +            "map/Key1",
  +            new Integer[] { new Integer(7), new Integer(8)});
  +
           // And then an element in that collection
  -        assertXPathSetValue(context,
  -                "map/Key1[1]", 
  -                new Integer(9));
  -    }
  -    
  -    public void testSetNewKey(){
  -        assertXPathSetValue(context,
  -                "map/Key4", 
  -                new Integer(7));
  -    }
  -    
  -    public void testCreatePath(){
  -        TestBean bean = (TestBean)context.getContextBean();
  +        assertXPathSetValue(context, "map/Key1[1]", new Integer(9));
  +    }
  +
  +    public void testSetNewKey() {
  +        assertXPathSetValue(context, "map/Key4", new Integer(7));
  +    }
  +
  +    public void testCreatePath() {
  +        TestBean bean = (TestBean) context.getContextBean();
           bean.setMap(null);
  -        
  +
           // Calls factory.createObject(..., testBean, "map"), then
           // sets the value
  -        assertXPathCreatePath(context, 
  -                "/map[@name='TestKey1']", 
  -                "", 
  -                "/map[@name='TestKey1']");
  -    }
  -    
  -    public void testCreatePathAndSetValue(){
  -        TestBean bean = (TestBean)context.getContextBean();
  +        assertXPathCreatePath(
  +            context,
  +            "/map[@name='TestKey1']",
  +            "",
  +            "/map[@name='TestKey1']");
  +    }
  +
  +    public void testCreatePathAndSetValue() {
  +        TestBean bean = (TestBean) context.getContextBean();
           bean.setMap(null);
  -        
  +
           // Calls factory.createObject(..., testBean, "map"), then
           // sets the value
  -        assertXPathCreatePathAndSetValue(context, 
  -                "/map[@name='TestKey1']", 
  -                "Test", 
  -                "/map[@name='TestKey1']");
  -    }
  -    
  -    public void testCreatePathCreateBean(){
  -        TestBean bean = (TestBean)context.getContextBean();
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/map[@name='TestKey1']",
  +            "Test",
  +            "/map[@name='TestKey1']");
  +    }
  +
  +    public void testCreatePathCreateBean() {
  +        TestBean bean = (TestBean) context.getContextBean();
           bean.setMap(null);
  -        
  +
           // Calls factory.createObject(..., testBean, "map"), then
           // then factory.createObject(..., map, "TestKey2"), then
           // sets the value
  -        assertXPathCreatePath(context, 
  -                "/map[@name='TestKey2']/int", 
  -                new Integer(1),
  -                "/map[@name='TestKey2']/int");
  -    }
  -    
  -    public void testCreatePathAndSetValueCreateBean(){
  -        TestBean bean = (TestBean)context.getContextBean();
  +        assertXPathCreatePath(
  +            context,
  +            "/map[@name='TestKey2']/int",
  +            new Integer(1),
  +            "/map[@name='TestKey2']/int");
  +    }
  +
  +    public void testCreatePathAndSetValueCreateBean() {
  +        TestBean bean = (TestBean) context.getContextBean();
           bean.setMap(null);
  -        
  +
           // Calls factory.createObject(..., testBean, "map"), then
           // then factory.createObject(..., map, "TestKey2"), then
           // sets the value
  -        assertXPathCreatePathAndSetValue(context, 
  -                "/map[@name='TestKey2']/int", 
  -                new Integer(4),
  -                "/map[@name='TestKey2']/int");
  -    }
  -    
  -    public void testCreatePathCollectionElement(){
  -        TestBean bean = (TestBean)context.getContextBean();
  -        bean.setMap(null);
  -        
  -
  -        assertXPathCreatePath(context, 
  -                "/map/TestKey3[2]", 
  -                null,
  -                "/map[@name='TestKey3'][2]");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/map[@name='TestKey2']/int",
  +            new Integer(4),
  +            "/map[@name='TestKey2']/int");
  +    }
  +
  +    public void testCreatePathCollectionElement() {
  +        TestBean bean = (TestBean) context.getContextBean();
  +        bean.setMap(null);
  +
  +        assertXPathCreatePath(
  +            context,
  +            "/map/TestKey3[2]",
  +            null,
  +            "/map[@name='TestKey3'][2]");
   
           // Should be the same as the one before
  -        assertXPathCreatePath(context, 
  -                "/map[@name='TestKey3'][3]", 
  -                null,
  -                "/map[@name='TestKey3'][3]");
  -    }
  -    
  -    public void testCreatePathAndSetValueCollectionElement(){
  -        TestBean bean = (TestBean)context.getContextBean();
  -        bean.setMap(null);
  -        
  -
  -        assertXPathCreatePathAndSetValue(context, 
  -                "/map/TestKey3[2]", 
  -                "Test1",
  -                "/map[@name='TestKey3'][2]");
  +        assertXPathCreatePath(
  +            context,
  +            "/map[@name='TestKey3'][3]",
  +            null,
  +            "/map[@name='TestKey3'][3]");
  +    }
  +
  +    public void testCreatePathAndSetValueCollectionElement() {
  +        TestBean bean = (TestBean) context.getContextBean();
  +        bean.setMap(null);
  +
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/map/TestKey3[2]",
  +            "Test1",
  +            "/map[@name='TestKey3'][2]");
   
           // Should be the same as the one before
  -        assertXPathCreatePathAndSetValue(context, 
  -                "/map[@name='TestKey3'][3]", 
  -                "Test2",
  -                "/map[@name='TestKey3'][3]");
  -    }
  -    
  -    public void testCreatePathNewCollectionElement(){
  -        TestBean bean = (TestBean)context.getContextBean();
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/map[@name='TestKey3'][3]",
  +            "Test2",
  +            "/map[@name='TestKey3'][3]");
  +    }
  +
  +    public void testCreatePathNewCollectionElement() {
  +        TestBean bean = (TestBean) context.getContextBean();
           bean.setMap(null);
  -        
  +
           // Create an element of a dynamic map element, which is a collection
  -        assertXPathCreatePath(context, 
  -                "/map/TestKey4[1]/int", 
  -                new Integer(1),
  -                "/map[@name='TestKey4'][1]/int");
  +        assertXPathCreatePath(
  +            context,
  +            "/map/TestKey4[1]/int",
  +            new Integer(1),
  +            "/map[@name='TestKey4'][1]/int");
   
           bean.getMap().remove("TestKey4");
   
           // Should be the same as the one before
  -        assertXPathCreatePath(context, 
  -                "/map/TestKey4[1]/int", 
  -                new Integer(1),
  -                "/map[@name='TestKey4'][1]/int");
  -    }
  -    
  -    public void testCreatePathAndSetValueNewCollectionElement(){
  -        TestBean bean = (TestBean)context.getContextBean();
  +        assertXPathCreatePath(
  +            context,
  +            "/map/TestKey4[1]/int",
  +            new Integer(1),
  +            "/map[@name='TestKey4'][1]/int");
  +    }
  +
  +    public void testCreatePathAndSetValueNewCollectionElement() {
  +        TestBean bean = (TestBean) context.getContextBean();
           bean.setMap(null);
  -        
  +
           // Create an element of a dynamic map element, which is a collection
  -        assertXPathCreatePathAndSetValue(context, 
  -                "/map/TestKey4[1]/int", 
  -                new Integer(2),
  -                "/map[@name='TestKey4'][1]/int");
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/map/TestKey4[1]/int",
  +            new Integer(2),
  +            "/map[@name='TestKey4'][1]/int");
   
           bean.getMap().remove("TestKey4");
   
           // Should be the same as the one before
  -        assertXPathCreatePathAndSetValue(context, 
  -                "/map/TestKey4[1]/int", 
  -                new Integer(3),
  -                "/map[@name='TestKey4'][1]/int");
  -    }
  -    
  -    public void testRemovePath(){
  -        TestBean bean = (TestBean)context.getContextBean();
  +        assertXPathCreatePathAndSetValue(
  +            context,
  +            "/map/TestKey4[1]/int",
  +            new Integer(3),
  +            "/map[@name='TestKey4'][1]/int");
  +    }
  +
  +    public void testRemovePath() {
  +        TestBean bean = (TestBean) context.getContextBean();
           bean.getMap().put("TestKey1", "test");
   
           // Remove dynamic property
           context.removePath("map[@name = 'TestKey1']");
  -        assertEquals("Remove dynamic property value", null,
  -                    context.getValue("map[@name = 'TestKey1']"));
  +        assertEquals(
  +            "Remove dynamic property value",
  +            null,
  +            context.getValue("map[@name = 'TestKey1']"));
       }
  -    
  -    public void testRemovePathArrayElement(){
  -        TestBean bean = (TestBean)context.getContextBean();
   
  -        bean.getMap().put("TestKey2", new String[]{"temp1", "temp2"});
  +    public void testRemovePathArrayElement() {
  +        TestBean bean = (TestBean) context.getContextBean();
  +
  +        bean.getMap().put("TestKey2", new String[] { "temp1", "temp2" });
           context.removePath("map[@name = 'TestKey2'][1]");
  -        assertEquals("Remove dynamic property collection element", "temp2",
  -                    context.getValue("map[@name = 'TestKey2'][1]"));
  +        assertEquals(
  +            "Remove dynamic property collection element",
  +            "temp2",
  +            context.getValue("map[@name = 'TestKey2'][1]"));
       }
   }
  
  
  
  1.2       +23 -15    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynamic/TestDynamicPropertyFactory.java
  
  Index: TestDynamicPropertyFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/dynamic/TestDynamicPropertyFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestDynamicPropertyFactory.java	28 Nov 2002 01:02:05 -0000	1.1
  +++ TestDynamicPropertyFactory.java	20 Jan 2003 00:00:29 -0000	1.2
  @@ -66,7 +66,11 @@
   import java.util.Map;
   import java.util.Vector;
   
  -import org.apache.commons.jxpath.*;
  +import org.apache.commons.jxpath.AbstractFactory;
  +import org.apache.commons.jxpath.JXPathContext;
  +import org.apache.commons.jxpath.NestedTestBean;
  +import org.apache.commons.jxpath.Pointer;
  +import org.apache.commons.jxpath.TestBean;
   
   /**
    * Test AbstractFactory.
  @@ -81,36 +85,40 @@
        * Return <b>false</b> if this factory cannot create the requested object.
        */
       public boolean createObject(
  -            JXPathContext context,
  -            Pointer pointer,
  -            Object parent,
  -            String name,
  -            int index) 
  +        JXPathContext context,
  +        Pointer pointer,
  +        Object parent,
  +        String name,
  +        int index) 
       {
           if (name.equals("map")) {
               ((TestBean) parent).setMap(new HashMap());
               return true;
  -        } else if (name.equals("TestKey1")) {
  +        }
  +        else if (name.equals("TestKey1")) {
               ((Map) parent).put(name, "");
               return true;
  -        } else if (name.equals("TestKey2")) {
  +        }
  +        else if (name.equals("TestKey2")) {
               ((Map) parent).put(name, new NestedTestBean("newName"));
               return true;
  -        } else if (name.equals("TestKey3")) {
  +        }
  +        else if (name.equals("TestKey3")) {
               Vector v = new Vector();
               for (int i = 0; i <= index; i++) {
                   v.add(null);
               }
               ((Map) parent).put(name, v);
               return true;
  -        } else if (name.equals("TestKey4")) {
  +        }
  +        else if (name.equals("TestKey4")) {
               ((Map) parent).put(name, new Object[] { new TestBean()});
               return true;
           }
           return false;
       }
   
  -    public boolean declareVariable(JXPathContext context, String name){
  +    public boolean declareVariable(JXPathContext context, String name) {
           return false;
       }
   }
  
  
  
  1.6       +69 -36    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/jdom/JDOMModelTest.java
  
  Index: JDOMModelTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/jdom/JDOMModelTest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JDOMModelTest.java	26 Nov 2002 01:33:35 -0000	1.5
  +++ JDOMModelTest.java	20 Jan 2003 00:00:29 -0000	1.6
  @@ -70,7 +70,10 @@
   import org.apache.commons.jxpath.AbstractFactory;
   import org.apache.commons.jxpath.ri.model.XMLModelTestCase;
   import org.apache.commons.jxpath.xml.DocumentContainer;
  -import org.jdom.*;
  +import org.jdom.CDATA;
  +import org.jdom.Document;
  +import org.jdom.Element;
  +import org.jdom.Text;
   
   /**
    * Tests JXPath with JDOM
  @@ -79,77 +82,107 @@
    * @version $Revision$ $Date$
    */
   
  -public class JDOMModelTest extends XMLModelTestCase
  -{
  +public class JDOMModelTest extends XMLModelTestCase {
       /**
        * Construct a new instance of this test case.
        *
        * @param name Name of the test case
        */
  -    public JDOMModelTest(String name){
  +    public JDOMModelTest(String name) {
           super(name);
       }
   
       /**
        * Return the tests included in this test suite.
        */
  -    public static Test suite(){
  +    public static Test suite() {
           return (new TestSuite(JDOMModelTest.class));
       }
   
  -    protected String getModel(){
  +    protected String getModel() {
           return DocumentContainer.MODEL_JDOM;
       }
   
  -    public void testID(){
  +    public void testID() {
           // id() is not supported by JDOM
       }
   
  -    protected AbstractFactory getAbstractFactory(){
  +    protected AbstractFactory getAbstractFactory() {
           return new TestJDOMFactory();
       }
  -    
  -    protected String getXMLSignature(Object node, 
  -            boolean elements, boolean attributes, boolean text, boolean pi){
  +
  +    protected String getXMLSignature(
  +        Object node,
  +        boolean elements,
  +        boolean attributes,
  +        boolean text,
  +        boolean pi) 
  +    {
           StringBuffer buffer = new StringBuffer();
           appendXMLSignature(buffer, node, elements, attributes, text, pi);
           return buffer.toString();
       }
  -    
  -    private void appendXMLSignature(StringBuffer buffer, Object object, 
  -            boolean elements, boolean attributes, boolean text, boolean pi){
  -        if (object instanceof Document){
  +
  +    private void appendXMLSignature(
  +        StringBuffer buffer,
  +        Object object,
  +        boolean elements,
  +        boolean attributes,
  +        boolean text,
  +        boolean pi) 
  +    {
  +        if (object instanceof Document) {
               buffer.append("<D>");
  -            appendXMLSignature(buffer, ((Document)object).getContent(), 
  -                    elements, attributes, text, pi);
  +            appendXMLSignature(
  +                buffer,
  +                ((Document) object).getContent(),
  +                elements,
  +                attributes,
  +                text,
  +                pi);
               buffer.append("</D");
           }
  -        else if (object instanceof Element){
  -            String tag = elements ? ((Element)object).getName() : "E";
  +        else if (object instanceof Element) {
  +            String tag = elements ? ((Element) object).getName() : "E";
               buffer.append("<");
               buffer.append(tag);
               buffer.append(">");
  -            appendXMLSignature(buffer, ((Element)object).getContent(), 
  -                    elements, attributes, text, pi);
  +            appendXMLSignature(
  +                buffer,
  +                ((Element) object).getContent(),
  +                elements,
  +                attributes,
  +                text,
  +                pi);
               buffer.append("</");
               buffer.append(tag);
  -            buffer.append(">");                 
  +            buffer.append(">");
           }
  -        else if (object instanceof Text || object instanceof CDATA){
  -            if (text){
  -                String string = ((Text)object).getText();
  +        else if (object instanceof Text || object instanceof CDATA) {
  +            if (text) {
  +                String string = ((Text) object).getText();
                   string = string.replace('\n', '=');
                   buffer.append(string);
               }
           }
       }
  -    
  -    private void appendXMLSignature(StringBuffer buffer, List children, 
  -            boolean elements, boolean attributes, boolean text, boolean pi)
  +
  +    private void appendXMLSignature(
  +        StringBuffer buffer,
  +        List children,
  +        boolean elements,
  +        boolean attributes,
  +        boolean text,
  +        boolean pi) 
       {
  -        for (int i = 0; i < children.size(); i++){
  -            appendXMLSignature(buffer, children.get(i), 
  -                    elements, attributes, text, pi);
  +        for (int i = 0; i < children.size(); i++) {
  +            appendXMLSignature(
  +                buffer,
  +                children.get(i),
  +                elements,
  +                attributes,
  +                text,
  +                pi);
           }
  -    }  
  +    }
   }
  
  
  
  1.2       +20 -15    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/jdom/TestJDOMFactory.java
  
  Index: TestJDOMFactory.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/jdom/TestJDOMFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestJDOMFactory.java	20 Oct 2002 03:48:22 -0000	1.1
  +++ TestJDOMFactory.java	20 Jan 2003 00:00:29 -0000	1.2
  @@ -81,30 +81,35 @@
        * Create a new instance and put it in the collection on the parent object.
        * Return <b>false</b> if this factory cannot create the requested object.
        */
  -    public boolean createObject(JXPathContext context, 
  -                Pointer pointer, Object parent, String name, int index)
  +    public boolean createObject(
  +        JXPathContext context,
  +        Pointer pointer,
  +        Object parent,
  +        String name,
  +        int index) 
       {
  -        if (name.equals("location") || 
  -                name.equals("address") || name.equals("street")){
  -            addJDOMElement((Element)parent, index, name);
  +        if (name.equals("location")
  +            || name.equals("address")
  +            || name.equals("street")) {
  +            addJDOMElement((Element) parent, index, name);
               return true;
           }
           return false;
       }
   
  -    private void addJDOMElement(Element parent, int index, String tag){
  +    private void addJDOMElement(Element parent, int index, String tag) {
           List children = parent.getContent();
           int count = 0;
  -        for (int i = 0; i < children.size(); i++){
  +        for (int i = 0; i < children.size(); i++) {
               Object child = children.get(i);
  -            if (child instanceof Element &&
  -                    ((Element)child).getQualifiedName().equals(tag)){
  +            if (child instanceof Element
  +                && ((Element) child).getQualifiedName().equals(tag)) {
                   count++;
               }
           }
   
           // Keep inserting new elements until we have index + 1 of them
  -        while (count <= index){
  +        while (count <= index) {
               // In a real factory we would need to do the right thing with
               // the namespace prefix.
               Element newElement = new Element(tag);
  @@ -113,7 +118,7 @@
           }
       }
   
  -    public boolean declareVariable(JXPathContext context, String name){
  +    public boolean declareVariable(JXPathContext context, String name) {
           return false;
       }
   }
  
  
  
  1.2       +39 -45    jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/util/BasicTypeConverterTest.java
  
  Index: BasicTypeConverterTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/util/BasicTypeConverterTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BasicTypeConverterTest.java	20 Oct 2002 03:48:23 -0000	1.1
  +++ BasicTypeConverterTest.java	20 Jan 2003 00:00:29 -0000	1.2
  @@ -77,77 +77,71 @@
    * @version $Revision$ $Date$
    */
   
  -public class BasicTypeConverterTest extends TestCase
  -{
  +public class BasicTypeConverterTest extends TestCase {
       /**
        * Construct a new instance of this test case.
        *
        * @param name Name of the test case
        */
  -    public BasicTypeConverterTest(String name)
  -    {
  +    public BasicTypeConverterTest(String name) {
           super(name);
       }
  -    
  -    public void testPrimitiveToString(){
  -        assertConversion(
  -                new Integer(1), 
  -                String.class, 
  -                "1");
  +
  +    public void testPrimitiveToString() {
  +        assertConversion(new Integer(1), String.class, "1");
       }
  -    
  -    public void testArrayToList(){
  +
  +    public void testArrayToList() {
           assertConversion(
  -                new int[]{1, 2}, 
  -                List.class,
  -                Arrays.asList(new Object[]{new Integer(1), new Integer(2)}));
  +            new int[] { 1, 2 },
  +            List.class,
  +            Arrays.asList(new Object[] { new Integer(1), new Integer(2)}));
       }
  -    
  -    public void testArrayToArray(){
  +
  +    public void testArrayToArray() {
           assertConversion(
  -                new int[]{1, 2}, 
  -                String[].class,
  -                Arrays.asList(new String[]{"1", "2"}));
  +            new int[] { 1, 2 },
  +            String[].class,
  +            Arrays.asList(new String[] { "1", "2" }));
       }
  -    
  -    public void testListToArray(){
  +
  +    public void testListToArray() {
           assertConversion(
  -                Arrays.asList(new Integer[]{new Integer(1), new Integer(2)}),
  -                String[].class,
  -                Arrays.asList(new String[]{"1", "2"}));
  -                
  +            Arrays.asList(new Integer[] { new Integer(1), new Integer(2)}),
  +            String[].class,
  +            Arrays.asList(new String[] { "1", "2" }));
  +
           assertConversion(
  -                Arrays.asList(new String[]{"1", "2"}),
  -                int[].class,
  -                Arrays.asList(new Integer[]{new Integer(1), new Integer(2)}));
  +            Arrays.asList(new String[] { "1", "2" }),
  +            int[].class,
  +            Arrays.asList(new Integer[] { new Integer(1), new Integer(2)}));
       }
  -    
  -    public void testInvalidConversion(){
  +
  +    public void testInvalidConversion() {
           boolean exception = false;
           try {
  -            TypeUtils.convert(
  -                    "'foo'",
  -                    Date.class);
  +            TypeUtils.convert("'foo'", Date.class);
           }
  -        catch (Throwable ex){
  +        catch (Throwable ex) {
               exception = true;
           }
           assertTrue("Type conversion exception", exception);
       }
  -    
  +
       public void assertConversion(Object from, Class toType, Object expected) {
           boolean can = TypeUtils.canConvert(from, toType);
  -        assertTrue("Can convert: " + from.getClass() + 
  -                " to " + toType, can);
  +        assertTrue("Can convert: " + from.getClass() + " to " + toType, can);
           Object result = TypeUtils.convert(from, toType);
  -        if (result.getClass().isArray()){
  +        if (result.getClass().isArray()) {
               ArrayList list = new ArrayList();
  -            for (int j = 0; j < Array.getLength(result); j++){
  +            for (int j = 0; j < Array.getLength(result); j++) {
                   list.add(Array.get(result, j));
               }
               result = list;
           }
  -        assertEquals("Convert: " + from.getClass() + 
  -                " to " + toType, expected, result);
  +        assertEquals(
  +            "Convert: " + from.getClass() + " to " + toType,
  +            expected,
  +            result);
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>