commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1102402 [13/20] - in /commons/sandbox/digester3/trunk/src: main/java/org/apache/commons/digester3/ main/java/org/apache/commons/digester3/annotations/ main/java/org/apache/commons/digester3/annotations/handlers/ main/java/org/apache/common...
Date Thu, 12 May 2011 18:03:33 GMT
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java Thu May 12 18:03:26 2011
@@ -16,10 +16,8 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import static org.junit.Assert.*;
 
 import java.io.IOException;
@@ -39,333 +37,265 @@ import org.junit.Before;
 import org.junit.Test;
 import org.xml.sax.SAXException;
 
-
 /**
- * <p> Test case for <code>BeanPropertySetterRule</code>.
- * This contains tests for the main applications of the rule
- * and two more general tests of digester functionality used by this rule.
+ * <p>
+ * Test case for <code>BeanPropertySetterRule</code>. This contains tests for the main applications of the rule and two
+ * more general tests of digester functionality used by this rule.
  */
-public class BeanPropertySetterRuleTestCase {
-
+public class BeanPropertySetterRuleTestCase
+{
 
     // ----------------------------------------------------- Instance Variables
 
     /**
      * Simple test xml document used in the tests.
      */
-    protected final static String TEST_XML =
-        "<?xml version='1.0'?>" +
-        "<root>ROOT BODY" +
-        "<alpha>ALPHA BODY</alpha>" +
-        "<beta>BETA BODY</beta>" +
-        "<gamma>GAMMA BODY</gamma>" +
-        "<delta>DELTA BODY</delta>" +
-        "</root>";
-
+    protected final static String TEST_XML = "<?xml version='1.0'?>" + "<root>ROOT BODY" + "<alpha>ALPHA BODY</alpha>"
+        + "<beta>BETA BODY</beta>" + "<gamma>GAMMA BODY</gamma>" + "<delta>DELTA BODY</delta>" + "</root>";
 
     /**
      * The digester instance we will be processing.
      */
     protected Digester digester = null;
 
-
     // --------------------------------------------------- Overall Test Methods
 
-
     /**
      * Set up instance variables required by this test case.
      */
     @Before
-    public void setUp() {
+    public void setUp()
+    {
 
         digester = new Digester();
 
     }
 
-
     /**
      * Tear down instance variables required by this test case.
      */
     @After
-    public void tearDown() {
+    public void tearDown()
+    {
 
         digester = null;
 
     }
 
-
-
     // ------------------------------------------------ Individual Test Methods
 
-
     /**
-     * This is a general digester test but it fits into here pretty well.
-     * This tests that the rule calling order is properly enforced.
+     * This is a general digester test but it fits into here pretty well. This tests that the rule calling order is
+     * properly enforced.
      */
     @Test
-    public void testDigesterRuleCallOrder() throws SAXException, IOException {
+    public void testDigesterRuleCallOrder()
+        throws SAXException, IOException
+    {
 
         List<Rule> callOrder = new ArrayList<Rule>();
 
         // use the standard rules
-        digester.setRules(new RulesBase());
+        digester.setRules( new RulesBase() );
 
         // add first test rule
-        TestRule firstRule = new TestRule("first");
-        firstRule.setOrder(callOrder);
-        digester.addRule("root/alpha", firstRule);
+        TestRule firstRule = new TestRule( "first" );
+        firstRule.setOrder( callOrder );
+        digester.addRule( "root/alpha", firstRule );
 
         // add second test rule
-        TestRule secondRule = new TestRule("second");
-        secondRule.setOrder(callOrder);
-        digester.addRule("root/alpha", secondRule);
+        TestRule secondRule = new TestRule( "second" );
+        secondRule.setOrder( callOrder );
+        digester.addRule( "root/alpha", secondRule );
 
         // add third test rule
-        TestRule thirdRule = new TestRule("third");
-        thirdRule.setOrder(callOrder);
-        digester.addRule("root/alpha", thirdRule);
-
+        TestRule thirdRule = new TestRule( "third" );
+        thirdRule.setOrder( callOrder );
+        digester.addRule( "root/alpha", thirdRule );
 
-        digester.parse(xmlTestReader());
+        digester.parse( xmlTestReader() );
 
         // we should have nine entries in our list of calls
 
-        assertEquals(
-                "Nine calls should have been made.",
-                9,
-                callOrder.size());
+        assertEquals( "Nine calls should have been made.", 9, callOrder.size() );
 
         // begin should be called in the order added
-        assertEquals(
-                "First rule begin not called first.",
-                "first",
-                ((TestRule) callOrder.get(0)).getIdentifier());
-
-        assertEquals(
-                "Second rule begin not called second.",
-                "second",
-                ((TestRule) callOrder.get(1)).getIdentifier());
-
-        assertEquals(
-                "Third rule begin not called third.",
-                "third",
-                ((TestRule) callOrder.get(2)).getIdentifier());
+        assertEquals( "First rule begin not called first.", "first", ( (TestRule) callOrder.get( 0 ) ).getIdentifier() );
+
+        assertEquals( "Second rule begin not called second.", "second",
+                      ( (TestRule) callOrder.get( 1 ) ).getIdentifier() );
+
+        assertEquals( "Third rule begin not called third.", "third", ( (TestRule) callOrder.get( 2 ) ).getIdentifier() );
 
         // body text should be called in the order added
-        assertEquals(
-                "First rule body text not called first.",
-                "first",
-                ((TestRule) callOrder.get(3)).getIdentifier());
-
-        assertEquals(
-                "Second rule body text not called second.",
-                "second",
-                ((TestRule) callOrder.get(4)).getIdentifier());
-
-        assertEquals(
-                "Third rule body text not called third.",
-                "third",
-                ((TestRule) callOrder.get(5)).getIdentifier());
+        assertEquals( "First rule body text not called first.", "first",
+                      ( (TestRule) callOrder.get( 3 ) ).getIdentifier() );
+
+        assertEquals( "Second rule body text not called second.", "second",
+                      ( (TestRule) callOrder.get( 4 ) ).getIdentifier() );
+
+        assertEquals( "Third rule body text not called third.", "third",
+                      ( (TestRule) callOrder.get( 5 ) ).getIdentifier() );
 
         // end should be called in reverse order
-        assertEquals(
-                "Third rule end not called first.",
-                "third",
-                ((TestRule) callOrder.get(6)).getIdentifier());
-
-        assertEquals(
-                "Second rule end not called second.",
-                "second",
-                ((TestRule) callOrder.get(7)).getIdentifier());
-
-        assertEquals(
-                "First rule end not called third.",
-                "first",
-                ((TestRule) callOrder.get(8)).getIdentifier());
+        assertEquals( "Third rule end not called first.", "third", ( (TestRule) callOrder.get( 6 ) ).getIdentifier() );
 
+        assertEquals( "Second rule end not called second.", "second", ( (TestRule) callOrder.get( 7 ) ).getIdentifier() );
 
-    }
+        assertEquals( "First rule end not called third.", "first", ( (TestRule) callOrder.get( 8 ) ).getIdentifier() );
 
+    }
 
     /**
-     * This is a general digester test but it fits into here pretty well.
-     * This tests that the body text stack is functioning correctly.
+     * This is a general digester test but it fits into here pretty well. This tests that the body text stack is
+     * functioning correctly.
      */
     @Test
-    public void testDigesterBodyTextStack() throws SAXException, IOException {
+    public void testDigesterBodyTextStack()
+        throws SAXException, IOException
+    {
 
         // use the standard rules
-        digester.setRules(new RulesBase());
+        digester.setRules( new RulesBase() );
 
         // add test rule to catch body text
-        TestRule rootRule = new TestRule("root");
-        digester.addRule("root", rootRule);
+        TestRule rootRule = new TestRule( "root" );
+        digester.addRule( "root", rootRule );
 
         // add test rule to catch body text
-        TestRule alphaRule = new TestRule("root/alpha");
-        digester.addRule("root/alpha", alphaRule);
+        TestRule alphaRule = new TestRule( "root/alpha" );
+        digester.addRule( "root/alpha", alphaRule );
 
         // add test rule to catch body text
-        TestRule betaRule = new TestRule("root/beta");
-        digester.addRule("root/beta", betaRule);
+        TestRule betaRule = new TestRule( "root/beta" );
+        digester.addRule( "root/beta", betaRule );
 
         // add test rule to catch body text
-        TestRule gammaRule = new TestRule("root/gamma");
-        digester.addRule("root/gamma", gammaRule);
+        TestRule gammaRule = new TestRule( "root/gamma" );
+        digester.addRule( "root/gamma", gammaRule );
 
-        digester.parse(xmlTestReader());
+        digester.parse( xmlTestReader() );
 
-        assertEquals(
-                "Root body text not set correct.",
-                "ROOT BODY",
-                rootRule.getBodyText());
-
-        assertEquals(
-                "Alpha body text not set correct.",
-                "ALPHA BODY",
-                alphaRule.getBodyText());
-
-        assertEquals(
-                "Beta body text not set correct.",
-                "BETA BODY",
-                betaRule.getBodyText());
-
-        assertEquals(
-                "Gamma body text not set correct.",
-                "GAMMA BODY",
-                gammaRule.getBodyText());
+        assertEquals( "Root body text not set correct.", "ROOT BODY", rootRule.getBodyText() );
 
-    }
+        assertEquals( "Alpha body text not set correct.", "ALPHA BODY", alphaRule.getBodyText() );
+
+        assertEquals( "Beta body text not set correct.", "BETA BODY", betaRule.getBodyText() );
 
+        assertEquals( "Gamma body text not set correct.", "GAMMA BODY", gammaRule.getBodyText() );
+
+    }
 
     /**
      * Test that you can successfully set a given property
      */
     @Test
-    public void testSetGivenProperty() throws SAXException, IOException {
+    public void testSetGivenProperty()
+        throws SAXException, IOException
+    {
 
         // use the standard rules
-        digester.setRules(new RulesBase());
+        digester.setRules( new RulesBase() );
 
         // going to be setting properties on a SimpleTestBean
-        digester.addObjectCreate("root",
-                                 "org.apache.commons.digester3.SimpleTestBean");
+        digester.addObjectCreate( "root", "org.apache.commons.digester3.SimpleTestBean" );
 
         // we'll set property alpha with the body text of root
-        digester.addRule("root", new BeanPropertySetterRule("alpha"));
+        digester.addRule( "root", new BeanPropertySetterRule( "alpha" ) );
 
         // we'll set property beta with the body text of child element alpha
-        digester.addRule("root/alpha", new BeanPropertySetterRule("beta"));
+        digester.addRule( "root/alpha", new BeanPropertySetterRule( "beta" ) );
 
         // we'll leave property gamma alone
 
         // we'll set property delta (a write-only property) also
-        digester.addRule("root/delta", new BeanPropertySetterRule("delta"));
+        digester.addRule( "root/delta", new BeanPropertySetterRule( "delta" ) );
 
-        SimpleTestBean bean = digester.parse(xmlTestReader());
+        SimpleTestBean bean = digester.parse( xmlTestReader() );
 
         // check properties are set correctly
-        assertEquals(
-                "Property alpha not set correctly",
-                "ROOT BODY",
-                bean.getAlpha());
-
-        assertEquals(
-                "Property beta not set correctly",
-                "ALPHA BODY",
-                bean.getBeta());
-
-        assertTrue(
-                "Property gamma not set correctly",
-                bean.getGamma() == null);
-
-        assertEquals("Property delta not set correctly",
-                     "DELTA BODY",
-                     bean.getDeltaValue());
-                    
+        assertEquals( "Property alpha not set correctly", "ROOT BODY", bean.getAlpha() );
 
-    }
+        assertEquals( "Property beta not set correctly", "ALPHA BODY", bean.getBeta() );
+
+        assertTrue( "Property gamma not set correctly", bean.getGamma() == null );
 
+        assertEquals( "Property delta not set correctly", "DELTA BODY", bean.getDeltaValue() );
+
+    }
 
     /**
      * Test that trying to set an unknown property throws an exception.
      */
     @Test
-    public void testSetUnknownProperty() {
+    public void testSetUnknownProperty()
+    {
 
         // going to be setting properties on a SimpleTestBean
-        digester.addObjectCreate("root",
-                                 "org.apache.commons.digester3.SimpleTestBean");
+        digester.addObjectCreate( "root", "org.apache.commons.digester3.SimpleTestBean" );
 
         // attempt to set an unknown property name
-        digester.addRule("root/alpha",
-                         new BeanPropertySetterRule("unknown"));
+        digester.addRule( "root/alpha", new BeanPropertySetterRule( "unknown" ) );
 
         // Attempt to parse the input
-        try {
-            SimpleTestBean bean = digester.parse(xmlTestReader());
-            fail("Should have thrown NoSuchMethodException");
-            assertNotNull(bean); // just to avoid compiler warning on unused variable
-        } catch (Exception e) {
-            if (e instanceof InvocationTargetException) {
-                Throwable t =
-                    ((InvocationTargetException) e).getTargetException();
-                if (t instanceof NoSuchMethodException) {
+        try
+        {
+            SimpleTestBean bean = digester.parse( xmlTestReader() );
+            fail( "Should have thrown NoSuchMethodException" );
+            assertNotNull( bean ); // just to avoid compiler warning on unused variable
+        }
+        catch ( Exception e )
+        {
+            if ( e instanceof InvocationTargetException )
+            {
+                Throwable t = ( (InvocationTargetException) e ).getTargetException();
+                if ( t instanceof NoSuchMethodException )
+                {
                     // Expected result
-                } else {
-                    fail("Should have thrown NoSuchMethodException, threw " + t);
+                }
+                else
+                {
+                    fail( "Should have thrown NoSuchMethodException, threw " + t );
                 }
             }
         }
 
     }
 
-
     /**
      * Test that you can successfully automatically set properties.
      */
     @Test
     public void testAutomaticallySetProperties()
-        throws SAXException, IOException {
+        throws SAXException, IOException
+    {
 
         // need the extended rules
-        digester.setRules(new ExtendedBaseRules());
+        digester.setRules( new ExtendedBaseRules() );
 
         // going to be setting properties on a SimpleTestBean
-        digester.addObjectCreate("root",
-                                 "org.apache.commons.digester3.SimpleTestBean");
+        digester.addObjectCreate( "root", "org.apache.commons.digester3.SimpleTestBean" );
 
         // match all children of root with this rule
-        digester.addRule("root/?", new BeanPropertySetterRule());
+        digester.addRule( "root/?", new BeanPropertySetterRule() );
 
-        SimpleTestBean bean = digester.parse(xmlTestReader());
+        SimpleTestBean bean = digester.parse( xmlTestReader() );
 
         // check properties are set correctly
-        assertEquals(
-                "Property alpha not set correctly",
-                "ALPHA BODY",
-                bean.getAlpha());
-
-        assertEquals(
-                "Property beta not set correctly",
-                "BETA BODY",
-                bean.getBeta());
-
-        assertEquals(
-                "Property gamma not set correctly",
-                "GAMMA BODY",
-                bean.getGamma());
+        assertEquals( "Property alpha not set correctly", "ALPHA BODY", bean.getAlpha() );
+
+        assertEquals( "Property beta not set correctly", "BETA BODY", bean.getBeta() );
 
+        assertEquals( "Property gamma not set correctly", "GAMMA BODY", bean.getGamma() );
 
     }
 
     /**
      * Get input stream from {@link #TEST_XML}.
      */
-    private Reader xmlTestReader() {
-        return new StringReader(TEST_XML);
+    private Reader xmlTestReader()
+    {
+        return new StringReader( TEST_XML );
     }
 
 }
-
-

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BetaBean.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BetaBean.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BetaBean.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BetaBean.java Thu May 12 18:03:26 2011
@@ -18,38 +18,49 @@
 
 package org.apache.commons.digester3;
 
-public class BetaBean implements Nameable {
+public class BetaBean
+    implements Nameable
+{
     private String name = "BETA";
-    
+
     private Nameable child;
+
     private Nameable parent;
 
-    public BetaBean() {}
-    
-    public String getName() {
+    public BetaBean()
+    {
+    }
+
+    public String getName()
+    {
         return name;
     }
-    
-    public void setName(String name) {
+
+    public void setName( String name )
+    {
         this.name = name;
     }
-    
-    public void setParent(Nameable parent) {
+
+    public void setParent( Nameable parent )
+    {
         this.parent = parent;
     }
-    
-    public Nameable getParent() {
+
+    public Nameable getParent()
+    {
         return parent;
     }
-    
-    public void setChild(Nameable child) {
+
+    public void setChild( Nameable child )
+    {
         this.child = child;
     }
-    
-    public Nameable getChild() {
+
+    public Nameable getChild()
+    {
         return child;
     }
-    
+
     @Override
     public String toString()
     {

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/Box.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/Box.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/Box.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/Box.java Thu May 12 18:03:26 2011
@@ -22,59 +22,67 @@ import java.util.LinkedList;
 import java.util.List;
 
 /**
- * Simple class for use in unit tests. A box has an ID, and can have
- * multiple boxes within it.
+ * Simple class for use in unit tests. A box has an ID, and can have multiple boxes within it.
  */
-public class Box {
+public class Box
+{
     private String id;
-    
+
     private List<Box> children = new LinkedList<Box>();
 
-    public Box() {}
-    
-    public String getId() {
+    public Box()
+    {
+    }
+
+    public String getId()
+    {
         return id;
     }
-    
-    public void setId(String id) {
+
+    public void setId( String id )
+    {
         this.id = id;
     }
-    
-    public void addChild(Box child) {
-        this.children.add(child);
+
+    public void addChild( Box child )
+    {
+        this.children.add( child );
     }
-    
-    public List<Box> getChildren() {
+
+    public List<Box> getChildren()
+    {
         return children;
     }
-    
+
     @Override
     public String toString()
     {
         StringBuilder buf = new StringBuilder();
-        buf.append("[Box] id=");
-        buf.append(id);
-        buf.append(" nchildren=");
-        buf.append(children.size());
-        
-        for(Box child : children) {
-            buf.append("  ");
-            buf.append(child.toString());
+        buf.append( "[Box] id=" );
+        buf.append( id );
+        buf.append( " nchildren=" );
+        buf.append( children.size() );
+
+        for ( Box child : children )
+        {
+            buf.append( "  " );
+            buf.append( child.toString() );
         }
         return buf.toString();
     }
-    
+
     /**
-     * Return a string containing this object's name value, followed by the
-     * names of all child objects (and their children etc) in pre-order
-     * sequence. Each name is separated by a space from the preceding one.
+     * Return a string containing this object's name value, followed by the names of all child objects (and their
+     * children etc) in pre-order sequence. Each name is separated by a space from the preceding one.
      */
-    public String getIds() {
+    public String getIds()
+    {
         StringBuilder buf = new StringBuilder();
-        buf.append(this.id);
-        for(Box child : children) {
-            buf.append(" ");
-            buf.append(child.getIds());
+        buf.append( this.id );
+        for ( Box child : children )
+        {
+            buf.append( " " );
+            buf.append( child.getIds() );
         }
         return buf.toString();
     }

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/CallMethodRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/CallMethodRuleTestCase.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/CallMethodRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/CallMethodRuleTestCase.java Thu May 12 18:03:26 2011
@@ -16,10 +16,8 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -43,205 +41,188 @@ import org.xml.sax.SAXException;
 //import org.apache.commons.logging.impl.SimpleLog;
 
 /**
- * <p>Tests for the <code>CallMethodRule</code> and associated 
- * <code>CallParamRule</code>.
- *
- * @author Christopher Lenz 
+ * <p>
+ * Tests for the <code>CallMethodRule</code> and associated <code>CallParamRule</code>.
+ * 
+ * @author Christopher Lenz
  */
-public class CallMethodRuleTestCase {
-
+public class CallMethodRuleTestCase
+{
 
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * The digester instance we will be processing.
      */
     protected Digester digester = null;
 
-
     // --------------------------------------------------- Overall Test Methods
 
-
     /**
      * Set up instance variables required by this test case.
      */
     @Before
-    public void setUp() {
+    public void setUp()
+    {
 
         digester = new Digester();
 
     }
 
-
     /**
      * Tear down instance variables required by this test case.
      */
     @After
-    public void tearDown() {
+    public void tearDown()
+    {
 
         digester = null;
 
     }
 
-
-
     // ------------------------------------------------ Individual Test Methods
 
-
     /**
-     * Test method calls with the CallMethodRule rule. It should be possible
-     * to call a method with no arguments using several rule syntaxes.
+     * Test method calls with the CallMethodRule rule. It should be possible to call a method with no arguments using
+     * several rule syntaxes.
      */
     @Test
-    public void testBasic() throws SAXException, IOException {
-        
+    public void testBasic()
+        throws SAXException, IOException
+    {
+
         // Configure the digester as required
-        digester.addObjectCreate("employee", Employee.class);
+        digester.addObjectCreate( "employee", Employee.class );
         // try all syntax permutations
-        digester.addCallMethod("employee", "toString", 0, (Class[])null);
-        digester.addCallMethod("employee", "toString", 0, (String[])null);
-        digester.addCallMethod("employee", "toString", 0, new Class[] {});
-        digester.addCallMethod("employee", "toString", 0, new String[] {});
-        digester.addCallMethod("employee", "toString");
+        digester.addCallMethod( "employee", "toString", 0, (Class[]) null );
+        digester.addCallMethod( "employee", "toString", 0, (String[]) null );
+        digester.addCallMethod( "employee", "toString", 0, new Class[] {} );
+        digester.addCallMethod( "employee", "toString", 0, new String[] {} );
+        digester.addCallMethod( "employee", "toString" );
 
         // Parse our test input.
         // An exception will be thrown if the method can't be found
-        Object root1 = digester.parse(getInputStream("Test5.xml"));
-        assertNotNull(root1);
+        Object root1 = digester.parse( getInputStream( "Test5.xml" ) );
+        assertNotNull( root1 );
     }
 
-
     /**
-     * Test method calls with the CallMethodRule reading from the element
-     * body, with no CallParamMethod rules added.
+     * Test method calls with the CallMethodRule reading from the element body, with no CallParamMethod rules added.
      */
     @Test
-    public void testCallMethodOnly() throws Exception {
+    public void testCallMethodOnly()
+        throws Exception
+    {
 
         // Configure the digester as required
-        digester.addObjectCreate("employee", Employee.class);
-        digester.addCallMethod("employee/firstName", "setFirstName", 0);
-        digester.addCallMethod("employee/lastName", "setLastName", 0);
+        digester.addObjectCreate( "employee", Employee.class );
+        digester.addCallMethod( "employee/firstName", "setFirstName", 0 );
+        digester.addCallMethod( "employee/lastName", "setLastName", 0 );
 
         // Parse our test input
-        Employee employee = digester.parse(getInputStream("Test9.xml"));
-        assertNotNull("parsed an employee", employee);
+        Employee employee = digester.parse( getInputStream( "Test9.xml" ) );
+        assertNotNull( "parsed an employee", employee );
 
         // Validate that the property setters were called
-        assertEquals("Set first name", "First Name", employee.getFirstName());
-        assertEquals("Set last name", "Last Name", employee.getLastName());
+        assertEquals( "Set first name", "First Name", employee.getFirstName() );
+        assertEquals( "Set last name", "Last Name", employee.getLastName() );
     }
 
-
     /**
-     * Test CallMethodRule variants which specify the classes of the
-     * parameters to target methods. String, int, boolean, float should all 
-     * be acceptable as parameter types.
+     * Test CallMethodRule variants which specify the classes of the parameters to target methods. String, int, boolean,
+     * float should all be acceptable as parameter types.
      */
     @Test
-    public void testSettingProperties() throws SAXException, IOException {
-            
+    public void testSettingProperties()
+        throws SAXException, IOException
+    {
+
         // Configure the digester as required
-        digester.addObjectCreate("employee", Employee.class);
+        digester.addObjectCreate( "employee", Employee.class );
         // try all syntax permutations
-        digester.addCallMethod("employee", "setLastName", 1, 
-                                new String[] {"java.lang.String"});
-        digester.addCallParam("employee/lastName", 0);
-                
+        digester.addCallMethod( "employee", "setLastName", 1, new String[] { "java.lang.String" } );
+        digester.addCallParam( "employee/lastName", 0 );
+
         // Parse our test input
 
         // an exception will be thrown if the method can't be found
-        Employee employee = digester.parse(getInputStream("Test5.xml"));
-        assertEquals("Failed to call Employee.setLastName", 
-                    "Last Name", employee.getLastName()); 
-        
+        Employee employee = digester.parse( getInputStream( "Test5.xml" ) );
+        assertEquals( "Failed to call Employee.setLastName", "Last Name", employee.getLastName() );
 
         digester = new Digester();
         // Configure the digester as required
-        digester.addObjectCreate("employee", Employee.class);
+        digester.addObjectCreate( "employee", Employee.class );
         // try out primitive convertion
-        digester.addCallMethod("employee", "setAge", 1, 
-                                new Class[] {int.class});
-        digester.addCallParam("employee/age", 0);         
-                
+        digester.addCallMethod( "employee", "setAge", 1, new Class[] { int.class } );
+        digester.addCallParam( "employee/age", 0 );
+
         // Parse our test input
         // an exception will be thrown if the method can't be found
-        employee = digester.parse(getInputStream("Test5.xml"));
-        assertEquals("Failed to call Employee.setAge", 21, employee.getAge()); 
-        
+        employee = digester.parse( getInputStream( "Test5.xml" ) );
+        assertEquals( "Failed to call Employee.setAge", 21, employee.getAge() );
+
         digester = new Digester();
         // Configure the digester as required
-        digester.addObjectCreate("employee", Employee.class);      
-        digester.addCallMethod("employee", "setActive", 1, 
-                                new Class[] {boolean.class});
-        digester.addCallParam("employee/active", 0);    
-                
+        digester.addObjectCreate( "employee", Employee.class );
+        digester.addCallMethod( "employee", "setActive", 1, new Class[] { boolean.class } );
+        digester.addCallParam( "employee/active", 0 );
+
         // Parse our test input
         // an exception will be thrown if the method can't be found
-        employee = digester.parse(getInputStream("Test5.xml"));
-        assertEquals("Failed to call Employee.setActive", 
-                        true, employee.isActive()); 
-        
-        digester = new Digester();            
+        employee = digester.parse( getInputStream( "Test5.xml" ) );
+        assertEquals( "Failed to call Employee.setActive", true, employee.isActive() );
+
+        digester = new Digester();
         // Configure the digester as required
-        digester.addObjectCreate("employee", Employee.class); 
-        digester.addCallMethod("employee", "setSalary", 1, 
-                                new Class[] {float.class});
-        digester.addCallParam("employee/salary", 0);    
-                
+        digester.addObjectCreate( "employee", Employee.class );
+        digester.addCallMethod( "employee", "setSalary", 1, new Class[] { float.class } );
+        digester.addCallParam( "employee/salary", 0 );
+
         // Parse our test input
         // an exception will be thrown if the method can't be found
-        employee = digester.parse(getInputStream("Test5.xml"));
-        assertEquals("Failed to call Employee.setSalary", 
-                        1000000.0f, employee.getSalary(), 0.1f); 
+        employee = digester.parse( getInputStream( "Test5.xml" ) );
+        assertEquals( "Failed to call Employee.setSalary", 1000000.0f, employee.getSalary(), 0.1f );
     }
 
-
     /**
-     * This tests the call methods params enhancement that provides 
-     * for more complex stack-based calls.
+     * This tests the call methods params enhancement that provides for more complex stack-based calls.
      */
     @Test
-    public void testParamsFromStack() throws SAXException, IOException {
-
-        StringBuilder xml = new StringBuilder().
-            append("<?xml version='1.0'?>").
-            append("<map>").
-            append("  <key name='The key'/>").
-            append("  <value name='The value'/>").
-            append("</map>");
-
-        digester.addObjectCreate("map", HashMap.class);
-        digester.addCallMethod("map", "put", 2);
-        digester.addObjectCreate("map/key", AlphaBean.class);
-        digester.addSetProperties("map/key");
-        digester.addCallParam("map/key", 0, true);
-        digester.addObjectCreate("map/value", BetaBean.class);
-        digester.addSetProperties("map/value");
-        digester.addCallParam("map/value", 1, true);
-
-        HashMap<AlphaBean, BetaBean> map = digester.parse(new StringReader(xml.toString()));
-
-        assertNotNull(map);
-        assertEquals(1, map.size());
-        assertEquals("The key",
-                     map.keySet().iterator().next().getName());
-        assertEquals("The value",
-                     map.values().iterator().next().getName());
+    public void testParamsFromStack()
+        throws SAXException, IOException
+    {
+
+        StringBuilder xml =
+            new StringBuilder().append( "<?xml version='1.0'?>" ).append( "<map>" ).append( "  <key name='The key'/>" ).append( "  <value name='The value'/>" ).append( "</map>" );
+
+        digester.addObjectCreate( "map", HashMap.class );
+        digester.addCallMethod( "map", "put", 2 );
+        digester.addObjectCreate( "map/key", AlphaBean.class );
+        digester.addSetProperties( "map/key" );
+        digester.addCallParam( "map/key", 0, true );
+        digester.addObjectCreate( "map/value", BetaBean.class );
+        digester.addSetProperties( "map/value" );
+        digester.addCallParam( "map/value", 1, true );
+
+        HashMap<AlphaBean, BetaBean> map = digester.parse( new StringReader( xml.toString() ) );
+
+        assertNotNull( map );
+        assertEquals( 1, map.size() );
+        assertEquals( "The key", map.keySet().iterator().next().getName() );
+        assertEquals( "The value", map.values().iterator().next().getName() );
     }
 
-
     /**
-     * Test that the target object for a CallMethodRule is the object that was
-     * on top of the object stack when the CallMethodRule fired, even when other
-     * rules fire between the CallMethodRule and its associated CallParamRules.
+     * Test that the target object for a CallMethodRule is the object that was on top of the object stack when the
+     * CallMethodRule fired, even when other rules fire between the CallMethodRule and its associated CallParamRules.
      * <p>
-     * The current implementation of CallMethodRule ensures this works by
-     * firing only at the end of the tag that CallMethodRule triggered on.
+     * The current implementation of CallMethodRule ensures this works by firing only at the end of the tag that
+     * CallMethodRule triggered on.
      */
     @Test
-    public void testOrderNestedPartA() throws Exception {
+    public void testOrderNestedPartA()
+        throws Exception
+    {
 
         // Configure the digester as required
 
@@ -250,441 +231,456 @@ public class CallMethodRuleTestCase {
         // avaiable to the CallMethodRule until some other rules have fired,
         // in particular an ObjectCreateRule. The CallMethodRule should still
         // function correctly in this scenario.
-        digester.addObjectCreate("toplevel/element", NamedBean.class);
-        digester.addCallMethod("toplevel/element", "setName", 1);
-        digester.addCallParam("toplevel/element/element/element", 0, "name");
-        
-        digester.addObjectCreate("toplevel/element/element", NamedBean.class);
+        digester.addObjectCreate( "toplevel/element", NamedBean.class );
+        digester.addCallMethod( "toplevel/element", "setName", 1 );
+        digester.addCallParam( "toplevel/element/element/element", 0, "name" );
+
+        digester.addObjectCreate( "toplevel/element/element", NamedBean.class );
 
         // Parse our test input
         NamedBean root1 = null;
-        try {
+        try
+        {
             // an exception will be thrown if the method can't be found
-            root1 = digester.parse(getInputStream("Test8.xml"));
-            
-        } catch (Throwable t) {
+            root1 = digester.parse( getInputStream( "Test8.xml" ) );
+
+        }
+        catch ( Throwable t )
+        {
             // this means that the method can't be found and so the test fails
-            fail("Digester threw Exception:  " + t);
+            fail( "Digester threw Exception:  " + t );
         }
-        
+
         // if the CallMethodRule were to incorrectly invoke the method call
         // on the second-created NamedBean instance, then the root one would
         // have a null name. If it works correctly, the target element will
         // be the first-created (root) one, despite the fact that a second
-        // object instance was created between the firing of the 
+        // object instance was created between the firing of the
         // CallMethodRule and its associated CallParamRule.
-        assertEquals("Wrong method call order", "C", root1.getName());
+        assertEquals( "Wrong method call order", "C", root1.getName() );
     }
 
     /**
      * Test nested CallMethod rules.
      * <p>
-     * The current implementation of CallMethodRule, in which the method is
-     * invoked in its end() method, causes behaviour which some users find
-     * non-intuitive. In this test it can be seen to "reverse" the order of
-     * data processed. However this is the way CallMethodRule has always 
-     * behaved, and it is expected that apps out there rely on this call order 
-     * so this test is present to ensure that no-one changes this behaviour.
+     * The current implementation of CallMethodRule, in which the method is invoked in its end() method, causes
+     * behaviour which some users find non-intuitive. In this test it can be seen to "reverse" the order of data
+     * processed. However this is the way CallMethodRule has always behaved, and it is expected that apps out there rely
+     * on this call order so this test is present to ensure that no-one changes this behaviour.
      */
     @Test
-    public void testOrderNestedPartB() throws Exception {
-        
+    public void testOrderNestedPartB()
+        throws Exception
+    {
+
         // Configure the digester as required
         StringBuilder word = new StringBuilder();
-        digester.push(word);
-        digester.addCallMethod("*/element", "append", 1);
-        digester.addCallParam("*/element", 0, "name");
-        
+        digester.push( word );
+        digester.addCallMethod( "*/element", "append", 1 );
+        digester.addCallParam( "*/element", 0, "name" );
+
         // Parse our test input
         Object root1 = null;
-        try {
+        try
+        {
             // an exception will be thrown if the method can't be found
-            root1 = digester.parse(getInputStream("Test8.xml"));
-            assertNotNull(root1);
-        } catch (Throwable t) {
+            root1 = digester.parse( getInputStream( "Test8.xml" ) );
+            assertNotNull( root1 );
+        }
+        catch ( Throwable t )
+        {
             // this means that the method can't be found and so the test fails
-            fail("Digester threw Exception:  " + t);
+            fail( "Digester threw Exception:  " + t );
         }
-        
-        assertEquals("Wrong method call order", "CBA", word.toString());
+
+        assertEquals( "Wrong method call order", "CBA", word.toString() );
     }
 
     @Test
-    public void testPrimitiveReading() throws Exception {
-        StringReader reader = new StringReader(
-            "<?xml version='1.0' ?><root><bean good='true'/><bean good='false'/><bean/>"
-            + "<beanie bad='Fee Fie Foe Fum' good='true'/><beanie bad='Fee Fie Foe Fum' good='false'/>"
-            + "<beanie bad='Fee Fie Foe Fum'/></root>");
-            
+    public void testPrimitiveReading()
+        throws Exception
+    {
+        StringReader reader =
+            new StringReader( "<?xml version='1.0' ?><root><bean good='true'/><bean good='false'/><bean/>"
+                + "<beanie bad='Fee Fie Foe Fum' good='true'/><beanie bad='Fee Fie Foe Fum' good='false'/>"
+                + "<beanie bad='Fee Fie Foe Fum'/></root>" );
+
         Digester digester = new Digester();
-        
-        //SimpleLog log = new SimpleLog("[testPrimitiveReading:Digester]");
-        //log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
-        //digester.setLogger(log);
-        
-        digester.addObjectCreate("root/bean", PrimitiveBean.class);
-        digester.addSetNext("root/bean", "add");
-        Class<?> [] params = { Boolean.TYPE };
-        digester.addCallMethod("root/bean", "setBoolean", 1, params);
-        digester.addCallParam("root/bean", 0, "good");
-        
-        digester.addObjectCreate("root/beanie", PrimitiveBean.class);
-        digester.addSetNext("root/beanie", "add");
-        Class<?> [] beanieParams = { String.class, Boolean.TYPE };
-        digester.addCallMethod("root/beanie", "testSetBoolean", 2, beanieParams);
-        digester.addCallParam("root/beanie", 0, "bad");
-        digester.addCallParam("root/beanie", 1, "good");
-        
+
+        // SimpleLog log = new SimpleLog("[testPrimitiveReading:Digester]");
+        // log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
+        // digester.setLogger(log);
+
+        digester.addObjectCreate( "root/bean", PrimitiveBean.class );
+        digester.addSetNext( "root/bean", "add" );
+        Class<?>[] params = { Boolean.TYPE };
+        digester.addCallMethod( "root/bean", "setBoolean", 1, params );
+        digester.addCallParam( "root/bean", 0, "good" );
+
+        digester.addObjectCreate( "root/beanie", PrimitiveBean.class );
+        digester.addSetNext( "root/beanie", "add" );
+        Class<?>[] beanieParams = { String.class, Boolean.TYPE };
+        digester.addCallMethod( "root/beanie", "testSetBoolean", 2, beanieParams );
+        digester.addCallParam( "root/beanie", 0, "bad" );
+        digester.addCallParam( "root/beanie", 1, "good" );
+
         ArrayList<PrimitiveBean> list = new ArrayList<PrimitiveBean>();
-        digester.push(list);
-        digester.parse(reader);
-        
-        assertEquals("Wrong number of beans in list", 6, list.size());
-        PrimitiveBean bean = list.get(0);
-        assertTrue("Bean 0 property not called", bean.getSetBooleanCalled());
-        assertEquals("Bean 0 property incorrect", true, bean.getBoolean());
-        bean = list.get(1);
-        assertTrue("Bean 1 property not called", bean.getSetBooleanCalled());
-        assertEquals("Bean 1 property incorrect", false, bean.getBoolean());
-        bean = list.get(2);
+        digester.push( list );
+        digester.parse( reader );
+
+        assertEquals( "Wrong number of beans in list", 6, list.size() );
+        PrimitiveBean bean = list.get( 0 );
+        assertTrue( "Bean 0 property not called", bean.getSetBooleanCalled() );
+        assertEquals( "Bean 0 property incorrect", true, bean.getBoolean() );
+        bean = list.get( 1 );
+        assertTrue( "Bean 1 property not called", bean.getSetBooleanCalled() );
+        assertEquals( "Bean 1 property incorrect", false, bean.getBoolean() );
+        bean = list.get( 2 );
         // no attibute, no call is what's expected
-        assertTrue("Bean 2 property called", !bean.getSetBooleanCalled());
-        bean = list.get(3);
-        assertTrue("Bean 3 property not called", bean.getSetBooleanCalled());
-        assertEquals("Bean 3 property incorrect", true, bean.getBoolean());
-        bean = list.get(4);
-        assertTrue("Bean 4 property not called", bean.getSetBooleanCalled());
-        assertEquals("Bean 4 property incorrect", false, bean.getBoolean());
-        bean = list.get(5);
-        assertTrue("Bean 5 property not called", bean.getSetBooleanCalled());
-        assertEquals("Bean 5 property incorrect", false, bean.getBoolean());       
+        assertTrue( "Bean 2 property called", !bean.getSetBooleanCalled() );
+        bean = list.get( 3 );
+        assertTrue( "Bean 3 property not called", bean.getSetBooleanCalled() );
+        assertEquals( "Bean 3 property incorrect", true, bean.getBoolean() );
+        bean = list.get( 4 );
+        assertTrue( "Bean 4 property not called", bean.getSetBooleanCalled() );
+        assertEquals( "Bean 4 property incorrect", false, bean.getBoolean() );
+        bean = list.get( 5 );
+        assertTrue( "Bean 5 property not called", bean.getSetBooleanCalled() );
+        assertEquals( "Bean 5 property incorrect", false, bean.getBoolean() );
     }
 
     @Test
-    public void testFromStack() throws Exception {
-    
-        StringReader reader = new StringReader(
-            "<?xml version='1.0' ?><root><one/><two/><three/><four/><five/></root>");
-            
+    public void testFromStack()
+        throws Exception
+    {
+
+        StringReader reader =
+            new StringReader( "<?xml version='1.0' ?><root><one/><two/><three/><four/><five/></root>" );
+
         Digester digester = new Digester();
-        
-        Class<?> [] params = { String.class };
-        
-        digester.addObjectCreate("root/one", NamedBean.class);
-        digester.addSetNext("root/one", "add");
-        digester.addCallMethod("root/one", "setName", 1, params);
-        digester.addCallParam("root/one", 0, 2);
-        
-        digester.addObjectCreate("root/two", NamedBean.class);
-        digester.addSetNext("root/two", "add");
-        digester.addCallMethod("root/two", "setName", 1, params);
-        digester.addCallParam("root/two", 0, 3);
-        
-        digester.addObjectCreate("root/three", NamedBean.class);
-        digester.addSetNext("root/three", "add");
-        digester.addCallMethod("root/three", "setName", 1, params);
-        digester.addCallParam("root/three", 0, 4);
-        
-        digester.addObjectCreate("root/four", NamedBean.class);
-        digester.addSetNext("root/four", "add");
-        digester.addCallMethod("root/four", "setName", 1, params);
-        digester.addCallParam("root/four", 0, 5);
-        
-        digester.addObjectCreate("root/five", NamedBean.class);
-        digester.addSetNext("root/five", "add");
-        Class<?> [] newParams = { String.class, String.class };
-        digester.addCallMethod("root/five", "test", 2, newParams);
-        digester.addCallParam("root/five", 0, 10);
-        digester.addCallParam("root/five", 1, 3);
-        
+
+        Class<?>[] params = { String.class };
+
+        digester.addObjectCreate( "root/one", NamedBean.class );
+        digester.addSetNext( "root/one", "add" );
+        digester.addCallMethod( "root/one", "setName", 1, params );
+        digester.addCallParam( "root/one", 0, 2 );
+
+        digester.addObjectCreate( "root/two", NamedBean.class );
+        digester.addSetNext( "root/two", "add" );
+        digester.addCallMethod( "root/two", "setName", 1, params );
+        digester.addCallParam( "root/two", 0, 3 );
+
+        digester.addObjectCreate( "root/three", NamedBean.class );
+        digester.addSetNext( "root/three", "add" );
+        digester.addCallMethod( "root/three", "setName", 1, params );
+        digester.addCallParam( "root/three", 0, 4 );
+
+        digester.addObjectCreate( "root/four", NamedBean.class );
+        digester.addSetNext( "root/four", "add" );
+        digester.addCallMethod( "root/four", "setName", 1, params );
+        digester.addCallParam( "root/four", 0, 5 );
+
+        digester.addObjectCreate( "root/five", NamedBean.class );
+        digester.addSetNext( "root/five", "add" );
+        Class<?>[] newParams = { String.class, String.class };
+        digester.addCallMethod( "root/five", "test", 2, newParams );
+        digester.addCallParam( "root/five", 0, 10 );
+        digester.addCallParam( "root/five", 1, 3 );
+
         // prepare stack
-        digester.push("That lamb was sure to go.");
-        digester.push("And everywhere that Mary went,");
-        digester.push("It's fleece was white as snow.");
-        digester.push("Mary had a little lamb,");
-        
+        digester.push( "That lamb was sure to go." );
+        digester.push( "And everywhere that Mary went," );
+        digester.push( "It's fleece was white as snow." );
+        digester.push( "Mary had a little lamb," );
+
         ArrayList<NamedBean> list = new ArrayList<NamedBean>();
-        digester.push(list);
-        digester.parse(reader);
-        
-        assertEquals("Wrong number of beans in list", 5, list.size());
-        NamedBean bean = list.get(0);
-        assertEquals("Parameter not set from stack (1)", "Mary had a little lamb,", bean.getName());
-        bean = list.get(1);
-        assertEquals("Parameter not set from stack (2)", "It's fleece was white as snow.", bean.getName());
-        bean = list.get(2);
-        assertEquals("Parameter not set from stack (3)", "And everywhere that Mary went,", bean.getName());
-        bean = list.get(3);
-        assertEquals("Parameter not set from stack (4)", "That lamb was sure to go.", bean.getName());
-        bean = list.get(4);
-        assertEquals("Out of stack not set to null", null , bean.getName());
+        digester.push( list );
+        digester.parse( reader );
+
+        assertEquals( "Wrong number of beans in list", 5, list.size() );
+        NamedBean bean = list.get( 0 );
+        assertEquals( "Parameter not set from stack (1)", "Mary had a little lamb,", bean.getName() );
+        bean = list.get( 1 );
+        assertEquals( "Parameter not set from stack (2)", "It's fleece was white as snow.", bean.getName() );
+        bean = list.get( 2 );
+        assertEquals( "Parameter not set from stack (3)", "And everywhere that Mary went,", bean.getName() );
+        bean = list.get( 3 );
+        assertEquals( "Parameter not set from stack (4)", "That lamb was sure to go.", bean.getName() );
+        bean = list.get( 4 );
+        assertEquals( "Out of stack not set to null", null, bean.getName() );
     }
 
     @Test
-    public void testTwoCalls() throws Exception {
-        
-    
-        StringReader reader = new StringReader(
-            "<?xml version='1.0' ?><root>"
-            + "<param class='int' coolness='true'>25</param>"
-            + "<param class='long'>50</param>"
-            + "<param class='float' coolness='false'>90</param></root>");
-            
+    public void testTwoCalls()
+        throws Exception
+    {
+
+        StringReader reader =
+            new StringReader( "<?xml version='1.0' ?><root>" + "<param class='int' coolness='true'>25</param>"
+                + "<param class='long'>50</param>" + "<param class='float' coolness='false'>90</param></root>" );
+
         Digester digester = new Digester();
-        //SimpleLog log = new SimpleLog("{testTwoCalls:Digester]");
-        //log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
-        //digester.setLogger(log);
-        
+        // SimpleLog log = new SimpleLog("{testTwoCalls:Digester]");
+        // log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
+        // digester.setLogger(log);
+
         digester.addObjectCreate( "root/param", ParamBean.class );
         digester.addSetNext( "root/param", "add" );
         digester.addCallMethod( "root/param", "setThisAndThat", 2 );
         digester.addCallParam( "root/param", 0, "class" );
         digester.addCallParam( "root/param", 1 );
-        digester.addCallMethod( "root/param", "setCool", 1, new Class[] {boolean.class } );
+        digester.addCallMethod( "root/param", "setCool", 1, new Class[] { boolean.class } );
         digester.addCallParam( "root/param", 0, "coolness" );
-        
+
         ArrayList<ParamBean> list = new ArrayList<ParamBean>();
-        digester.push(list);
-        digester.parse(reader);
-    
-        assertEquals("Wrong number of objects created", 3, list.size());
-        ParamBean bean = list.get(0);
-        assertEquals("Coolness wrong (1)", true, bean.isCool());
-        assertEquals("This wrong (1)", "int", bean.getThis());
-        assertEquals("That wrong (1)", "25", bean.getThat());
-        bean = list.get(1);
-        assertEquals("Coolness wrong (2)", false, bean.isCool());
-        assertEquals("This wrong (2)", "long", bean.getThis());
-        assertEquals("That wrong (2)", "50", bean.getThat());
-        bean = list.get(2);
-        assertEquals("Coolness wrong (3)", false, bean.isCool());
-        assertEquals("This wrong (3)", "float", bean.getThis());
-        assertEquals("That wrong (3)", "90", bean.getThat());
+        digester.push( list );
+        digester.parse( reader );
+
+        assertEquals( "Wrong number of objects created", 3, list.size() );
+        ParamBean bean = list.get( 0 );
+        assertEquals( "Coolness wrong (1)", true, bean.isCool() );
+        assertEquals( "This wrong (1)", "int", bean.getThis() );
+        assertEquals( "That wrong (1)", "25", bean.getThat() );
+        bean = list.get( 1 );
+        assertEquals( "Coolness wrong (2)", false, bean.isCool() );
+        assertEquals( "This wrong (2)", "long", bean.getThis() );
+        assertEquals( "That wrong (2)", "50", bean.getThat() );
+        bean = list.get( 2 );
+        assertEquals( "Coolness wrong (3)", false, bean.isCool() );
+        assertEquals( "This wrong (3)", "float", bean.getThis() );
+        assertEquals( "That wrong (3)", "90", bean.getThat() );
     }
 
     @Test
-    public void testNestedBody() throws Exception {
-        
-        StringReader reader = new StringReader(
-            "<?xml version='1.0' ?><root>"
-            + "<spam>Simple</spam>"
-            + "<spam>Complex<spam>Deep<spam>Deeper<spam>Deepest</spam></spam></spam></spam>"
-            + "</root>");
-            
-        Digester digester = new Digester();        
-
-        //SimpleLog log = new SimpleLog("[testPrimitiveReading:Digester]");
-        //log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
-        //digester.setLogger(log);
-        
-        
-        digester.addObjectCreate("root/spam", NamedBean.class);
-        digester.addSetRoot("root/spam", "add");
+    public void testNestedBody()
+        throws Exception
+    {
+
+        StringReader reader =
+            new StringReader( "<?xml version='1.0' ?><root>" + "<spam>Simple</spam>"
+                + "<spam>Complex<spam>Deep<spam>Deeper<spam>Deepest</spam></spam></spam></spam>" + "</root>" );
+
+        Digester digester = new Digester();
+
+        // SimpleLog log = new SimpleLog("[testPrimitiveReading:Digester]");
+        // log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
+        // digester.setLogger(log);
+
+        digester.addObjectCreate( "root/spam", NamedBean.class );
+        digester.addSetRoot( "root/spam", "add" );
         digester.addCallMethod( "root/spam", "setName", 1 );
-        digester.addCallParam( "root/spam", 0);
-        
-        digester.addObjectCreate("root/spam/spam", NamedBean.class);
-        digester.addSetRoot("root/spam/spam", "add");
+        digester.addCallParam( "root/spam", 0 );
+
+        digester.addObjectCreate( "root/spam/spam", NamedBean.class );
+        digester.addSetRoot( "root/spam/spam", "add" );
         digester.addCallMethod( "root/spam/spam", "setName", 1 );
-        digester.addCallParam( "root/spam/spam", 0);        
-        
-        digester.addObjectCreate("root/spam/spam/spam", NamedBean.class);
-        digester.addSetRoot("root/spam/spam/spam", "add");
+        digester.addCallParam( "root/spam/spam", 0 );
+
+        digester.addObjectCreate( "root/spam/spam/spam", NamedBean.class );
+        digester.addSetRoot( "root/spam/spam/spam", "add" );
         digester.addCallMethod( "root/spam/spam/spam", "setName", 1 );
-        digester.addCallParam( "root/spam/spam/spam", 0);      
+        digester.addCallParam( "root/spam/spam/spam", 0 );
 
-        
-        digester.addObjectCreate("root/spam/spam/spam/spam", NamedBean.class);
-        digester.addSetRoot("root/spam/spam/spam/spam", "add");
+        digester.addObjectCreate( "root/spam/spam/spam/spam", NamedBean.class );
+        digester.addSetRoot( "root/spam/spam/spam/spam", "add" );
         digester.addCallMethod( "root/spam/spam/spam/spam", "setName", 1 );
-        digester.addCallParam( "root/spam/spam/spam/spam", 0);   
-        
+        digester.addCallParam( "root/spam/spam/spam/spam", 0 );
+
         ArrayList<NamedBean> list = new ArrayList<NamedBean>();
-        digester.push(list);
-        digester.parse(reader);
-        
-        NamedBean bean = list.get(0);
-        assertEquals("Wrong name (1)", "Simple", bean.getName());
+        digester.push( list );
+        digester.parse( reader );
+
+        NamedBean bean = list.get( 0 );
+        assertEquals( "Wrong name (1)", "Simple", bean.getName() );
         // these are added in deepest first order by the addRootRule
-        bean = list.get(4);
-        assertEquals("Wrong name (2)", "Complex", bean.getName());
-        bean = list.get(3);
-        assertEquals("Wrong name (3)", "Deep", bean.getName());
-        bean = list.get(2);
-        assertEquals("Wrong name (4)", "Deeper", bean.getName());
-        bean = list.get(1);
-        assertEquals("Wrong name (5)", "Deepest", bean.getName());
+        bean = list.get( 4 );
+        assertEquals( "Wrong name (2)", "Complex", bean.getName() );
+        bean = list.get( 3 );
+        assertEquals( "Wrong name (3)", "Deep", bean.getName() );
+        bean = list.get( 2 );
+        assertEquals( "Wrong name (4)", "Deeper", bean.getName() );
+        bean = list.get( 1 );
+        assertEquals( "Wrong name (5)", "Deepest", bean.getName() );
     }
 
     @Test
-    public void testProcessingHook() throws Exception {
-        
-        class TestCallMethodRule extends CallMethodRule {
+    public void testProcessingHook()
+        throws Exception
+    {
+
+        class TestCallMethodRule
+            extends CallMethodRule
+        {
             Object result;
-            TestCallMethodRule(String methodName, int paramCount)
+
+            TestCallMethodRule( String methodName, int paramCount )
             {
-                super(methodName, paramCount);
+                super( methodName, paramCount );
             }
+
             @Override
-            protected void processMethodCallResult(Object result) {
+            protected void processMethodCallResult( Object result )
+            {
                 this.result = result;
             }
         }
-    
-        StringReader reader = new StringReader(
-            "<?xml version='1.0' ?><root>"
-            + "<param class='float' coolness='false'>90</param></root>");
-        
-            
+
+        StringReader reader =
+            new StringReader( "<?xml version='1.0' ?><root>"
+                + "<param class='float' coolness='false'>90</param></root>" );
+
         Digester digester = new Digester();
-        //SimpleLog log = new SimpleLog("{testTwoCalls:Digester]");
-        //log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
-        //digester.setLogger(log);
-        
+        // SimpleLog log = new SimpleLog("{testTwoCalls:Digester]");
+        // log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
+        // digester.setLogger(log);
+
         digester.addObjectCreate( "root/param", ParamBean.class );
         digester.addSetNext( "root/param", "add" );
-        TestCallMethodRule rule = new TestCallMethodRule( "setThisAndThat" , 2 );
+        TestCallMethodRule rule = new TestCallMethodRule( "setThisAndThat", 2 );
         digester.addRule( "root/param", rule );
         digester.addCallParam( "root/param", 0, "class" );
         digester.addCallParam( "root/param", 1, "coolness" );
-        
+
         ArrayList<ParamBean> list = new ArrayList<ParamBean>();
-        digester.push(list);
-        digester.parse(reader);
-    
-        assertEquals("Wrong number of objects created", 1, list.size());
-        assertEquals("Result not passed into hook", "The Other", rule.result);
+        digester.push( list );
+        digester.parse( reader );
+
+        assertEquals( "Wrong number of objects created", 1, list.size() );
+        assertEquals( "Result not passed into hook", "The Other", rule.result );
     }
 
     /** Test for the PathCallParamRule */
     @Test
-    public void testPathCallParam() throws Exception {
-        String xml = "<?xml version='1.0'?><main>"
-            + "<alpha><beta>Ignore this</beta></alpha>"
-            + "<beta><epsilon><gamma>Ignore that</gamma></epsilon></beta>"
-            + "</main>";
-    
+    public void testPathCallParam()
+        throws Exception
+    {
+        String xml =
+            "<?xml version='1.0'?><main>" + "<alpha><beta>Ignore this</beta></alpha>"
+                + "<beta><epsilon><gamma>Ignore that</gamma></epsilon></beta>" + "</main>";
+
         SimpleTestBean bean = new SimpleTestBean();
-        bean.setAlphaBeta("[UNSET]", "[UNSET]");
-        
-        StringReader in = new StringReader(xml);
+        bean.setAlphaBeta( "[UNSET]", "[UNSET]" );
+
+        StringReader in = new StringReader( xml );
         Digester digester = new Digester();
-        digester.setRules(new ExtendedBaseRules());
-        digester.addCallParamPath("*/alpha/?", 0);
-        digester.addCallParamPath("*/epsilon/?", 1);
-        digester.addCallMethod("main", "setAlphaBeta", 2);
-        
-        digester.push(bean);
-        
-        digester.parse(in);
-        
-        assertEquals("Test alpha property setting", "main/alpha/beta" , bean.getAlpha());
-        assertEquals("Test beta property setting", "main/beta/epsilon/gamma" , bean.getBeta());
-    }
+        digester.setRules( new ExtendedBaseRules() );
+        digester.addCallParamPath( "*/alpha/?", 0 );
+        digester.addCallParamPath( "*/epsilon/?", 1 );
+        digester.addCallMethod( "main", "setAlphaBeta", 2 );
 
+        digester.push( bean );
+
+        digester.parse( in );
+
+        assertEquals( "Test alpha property setting", "main/alpha/beta", bean.getAlpha() );
+        assertEquals( "Test beta property setting", "main/beta/epsilon/gamma", bean.getBeta() );
+    }
 
-    /** 
+    /**
      * Test invoking an object which does not exist on the stack.
      */
     @Test
-    public void testCallInvalidTarget() throws Exception {
-    
+    public void testCallInvalidTarget()
+        throws Exception
+    {
+
         Digester digester = new Digester();
-        digester.addObjectCreate("employee", HashMap.class);
+        digester.addObjectCreate( "employee", HashMap.class );
 
         // there should be only one object on the stack (index zero),
         // so selecting a target object with index 1 on the object stack
         // should result in an exception.
-        CallMethodRule r = new CallMethodRule(1, "put", 0);
-        digester.addRule("employee", r);
-        
-        try {
-            digester.parse(getInputStream("Test5.xml"));
-            fail("Exception should be thrown for invalid target offset");
+        CallMethodRule r = new CallMethodRule( 1, "put", 0 );
+        digester.addRule( "employee", r );
+
+        try
+        {
+            digester.parse( getInputStream( "Test5.xml" ) );
+            fail( "Exception should be thrown for invalid target offset" );
         }
-        catch(SAXException e) {
+        catch ( SAXException e )
+        {
             // ok, exception expected
         }
     }
 
-    /** 
-     * Test invoking an object which is at top-1 on the stack, like
-     * SetNextRule does...
+    /**
+     * Test invoking an object which is at top-1 on the stack, like SetNextRule does...
      */
     @Test
-    public void testCallNext() throws Exception {
-    
+    public void testCallNext()
+        throws Exception
+    {
+
         Digester digester = new Digester();
-        digester.addObjectCreate("employee", HashMap.class);
+        digester.addObjectCreate( "employee", HashMap.class );
 
-        digester.addObjectCreate("employee/address", Address.class);
-        digester.addSetNestedProperties("employee/address");
-        CallMethodRule r = new CallMethodRule(1, "put", 2);
-        digester.addRule("employee/address", r);
-        digester.addCallParam("employee/address/type", 0);
-        digester.addCallParam("employee/address", 1, 0);
-        
-        HashMap<String, Address> map = digester.parse(getInputStream("Test5.xml"));
-        
-        assertNotNull(map);
+        digester.addObjectCreate( "employee/address", Address.class );
+        digester.addSetNestedProperties( "employee/address" );
+        CallMethodRule r = new CallMethodRule( 1, "put", 2 );
+        digester.addRule( "employee/address", r );
+        digester.addCallParam( "employee/address/type", 0 );
+        digester.addCallParam( "employee/address", 1, 0 );
+
+        HashMap<String, Address> map = digester.parse( getInputStream( "Test5.xml" ) );
+
+        assertNotNull( map );
         Set<String> keys = map.keySet();
-        assertEquals(2, keys.size());
-        Address home = map.get("home");
-        assertNotNull(home);
-        assertEquals("HmZip", home.getZipCode());
-        Address office = map.get("office");
-        assertNotNull(office);
-        assertEquals("OfZip", office.getZipCode());
-    }
-
-    /** 
-     * Test invoking an object which is at the root of the stack, like
-     * SetRoot does...
+        assertEquals( 2, keys.size() );
+        Address home = map.get( "home" );
+        assertNotNull( home );
+        assertEquals( "HmZip", home.getZipCode() );
+        Address office = map.get( "office" );
+        assertNotNull( office );
+        assertEquals( "OfZip", office.getZipCode() );
+    }
+
+    /**
+     * Test invoking an object which is at the root of the stack, like SetRoot does...
      */
     @Test
-    public void testCallRoot() throws Exception {
-    
+    public void testCallRoot()
+        throws Exception
+    {
+
         Digester digester = new Digester();
-        digester.addObjectCreate("employee", HashMap.class);
+        digester.addObjectCreate( "employee", HashMap.class );
 
-        digester.addObjectCreate("employee/address", Address.class);
-        digester.addSetNestedProperties("employee/address");
-        CallMethodRule r = new CallMethodRule(-1, "put", 2);
-        digester.addRule("employee/address", r);
-        digester.addCallParam("employee/address/type", 0);
-        digester.addCallParam("employee/address", 1, 0);
-        
-        HashMap<String, Address> map = digester.parse(getInputStream("Test5.xml"));
-        
-        assertNotNull(map);
+        digester.addObjectCreate( "employee/address", Address.class );
+        digester.addSetNestedProperties( "employee/address" );
+        CallMethodRule r = new CallMethodRule( -1, "put", 2 );
+        digester.addRule( "employee/address", r );
+        digester.addCallParam( "employee/address/type", 0 );
+        digester.addCallParam( "employee/address", 1, 0 );
+
+        HashMap<String, Address> map = digester.parse( getInputStream( "Test5.xml" ) );
+
+        assertNotNull( map );
         Set<String> keys = map.keySet();
-        assertEquals(2, keys.size());
-        Address home = map.get("home");
-        assertNotNull(home);
-        assertEquals("HmZip", home.getZipCode());
-        Address office = map.get("office");
-        assertNotNull(office);
-        assertEquals("OfZip", office.getZipCode());
+        assertEquals( 2, keys.size() );
+        Address home = map.get( "home" );
+        assertNotNull( home );
+        assertEquals( "HmZip", home.getZipCode() );
+        Address office = map.get( "office" );
+        assertNotNull( office );
+        assertEquals( "OfZip", office.getZipCode() );
     }
 
     // ------------------------------------------------ Utility Support Methods
 
-
     /**
-     * Return an appropriate InputStream for the specified test file (which
-     * must be inside our current package.
-     *
+     * Return an appropriate InputStream for the specified test file (which must be inside our current package.
+     * 
      * @param name Name of the test file we want
-     *
      * @exception IOException if an input/output error occurs
      */
-    protected InputStream getInputStream(String name) throws IOException {
+    protected InputStream getInputStream( String name )
+        throws IOException
+    {
 
-        return (this.getClass().getResourceAsStream
-                ("/org/apache/commons/digester3/" + name));
+        return ( this.getClass().getResourceAsStream( "/org/apache/commons/digester3/" + name ) );
 
     }
 
-
 }
-



Mime
View raw message