commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1102402 [15/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/NamespacedBox.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespacedBox.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespacedBox.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespacedBox.java Thu May 12 18:03:26 2011
@@ -21,26 +21,28 @@ package org.apache.commons.digester3;
 import java.util.Map;
 
 /**
- * Simple class for use in unit tests. A box with a namespaces property
- * to store the current namespaces as a Map.
- *
- * Used by NamespaceSnapshotTestCase.
+ * Simple class for use in unit tests. A box with a namespaces property to store the current namespaces as a Map. Used
+ * by NamespaceSnapshotTestCase.
  */
-public class NamespacedBox extends Box {
+public class NamespacedBox
+    extends Box
+{
 
     private Map<String, String> namespaces;
 
-    public NamespacedBox() {
+    public NamespacedBox()
+    {
         super();
     }
 
-    public Map<String, String> getNamespaces() {
+    public Map<String, String> getNamespaces()
+    {
         return namespaces;
     }
 
-    public void setNamespaces(Map<String, String> namespaces) {
+    public void setNamespaces( Map<String, String> namespaces )
+    {
         this.namespaces = namespaces;
     }
 
 }
-

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NodeCreateRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NodeCreateRuleTestCase.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NodeCreateRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NodeCreateRuleTestCase.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;
@@ -44,437 +42,445 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
 
-
 /**
- * <p>Test case for the <code>NodeCreateRule</code>.
+ * <p>
+ * Test case for the <code>NodeCreateRule</code>.
  * 
  * @author Christopher Lenz
  * @version $Revision$ $Date$
  */
 
-public class NodeCreateRuleTestCase {
-
+public class NodeCreateRuleTestCase
+{
 
     // ----------------------------------------------------- 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></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></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
 
-
     /**
-     * Tests simple element construction, using the {@link #TEST_XML}
-     * XML input data.
+     * Tests simple element construction, using the {@link #TEST_XML} XML input data.
      */
     @Test
-    public void testInvalidNodeTypes() throws Exception {
-
-        try {
-            Rule rule = new NodeCreateRule(Node.ATTRIBUTE_NODE);
-            fail("IllegalArgumentException expected for type ATTRIBUTE_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+    public void testInvalidNodeTypes()
+        throws Exception
+    {
+
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.ATTRIBUTE_NODE );
+            fail( "IllegalArgumentException expected for type ATTRIBUTE_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
-        try {
-            Rule rule = new NodeCreateRule(Node.CDATA_SECTION_NODE);
-            fail("IllegalArgumentException expected for type " +
-                 "CDATA_SECTION_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.CDATA_SECTION_NODE );
+            fail( "IllegalArgumentException expected for type " + "CDATA_SECTION_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
-        try {
-            Rule rule = new NodeCreateRule(Node.COMMENT_NODE);
-            fail("IllegalArgumentException expected for type COMMENT_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.COMMENT_NODE );
+            fail( "IllegalArgumentException expected for type COMMENT_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
-        try {
-            Rule rule = new NodeCreateRule(Node.DOCUMENT_NODE);
-            fail("IllegalArgumentException expected for type DOCUMENT_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.DOCUMENT_NODE );
+            fail( "IllegalArgumentException expected for type DOCUMENT_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
-        try {
-            Rule rule = new NodeCreateRule(Node.DOCUMENT_TYPE_NODE);
-            fail("IllegalArgumentException expected for type " +
-                 "DOCUMENT_TYPE_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.DOCUMENT_TYPE_NODE );
+            fail( "IllegalArgumentException expected for type " + "DOCUMENT_TYPE_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
-        try {
-            Rule rule = new NodeCreateRule(Node.ENTITY_NODE);
-            fail("IllegalArgumentException expected for type ENTITY_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.ENTITY_NODE );
+            fail( "IllegalArgumentException expected for type ENTITY_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
-        try {
-            Rule rule = new NodeCreateRule(Node.ENTITY_REFERENCE_NODE);
-            fail("IllegalArgumentException expected for type " +
-                 "ENTITY_REFERENCE_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.ENTITY_REFERENCE_NODE );
+            fail( "IllegalArgumentException expected for type " + "ENTITY_REFERENCE_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
-        try {
-            Rule rule = new NodeCreateRule(Node.NOTATION_NODE);
-            fail("IllegalArgumentException expected for type NOTATION_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.NOTATION_NODE );
+            fail( "IllegalArgumentException expected for type NOTATION_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
-        try {
-            Rule rule = new NodeCreateRule(Node.PROCESSING_INSTRUCTION_NODE);
-            fail("IllegalArgumentException expected for type " +
-                 "PROCESSING_INSTRUCTION_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.PROCESSING_INSTRUCTION_NODE );
+            fail( "IllegalArgumentException expected for type " + "PROCESSING_INSTRUCTION_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
-        try {
-            Rule rule = new NodeCreateRule(Node.TEXT_NODE);
-            fail("IllegalArgumentException expected for type TEXT_NODE");
-            assertNotNull(rule); // just to prevent compiler warning on unused var
-        } catch (IllegalArgumentException iae) {
+        try
+        {
+            Rule rule = new NodeCreateRule( Node.TEXT_NODE );
+            fail( "IllegalArgumentException expected for type TEXT_NODE" );
+            assertNotNull( rule ); // just to prevent compiler warning on unused var
+        }
+        catch ( IllegalArgumentException iae )
+        {
             // expected
         }
 
     }
 
     /**
-     * Tests simple element construction, using the {@link #TEST_XML}
-     * XML input data.
+     * Tests simple element construction, using the {@link #TEST_XML} XML input data.
      */
     @Test
     public void testElement()
-        throws SAXException, ParserConfigurationException, IOException {
+        throws SAXException, ParserConfigurationException, IOException
+    {
 
-        digester.addRule("root/alpha", new NodeCreateRule());
-        Element element = digester.parse(new StringReader(TEST_XML));
+        digester.addRule( "root/alpha", new NodeCreateRule() );
+        Element element = digester.parse( new StringReader( TEST_XML ) );
 
-        assertNotNull(element);
-        assertEquals("alpha", element.getNodeName());
-        assertNull(element.getLocalName());
-        assertNull(element.getNamespaceURI());
-        assertEquals(1, element.getChildNodes().getLength());
-        assertEquals("ALPHA BODY", element.getFirstChild().getNodeValue());
+        assertNotNull( element );
+        assertEquals( "alpha", element.getNodeName() );
+        assertNull( element.getLocalName() );
+        assertNull( element.getNamespaceURI() );
+        assertEquals( 1, element.getChildNodes().getLength() );
+        assertEquals( "ALPHA BODY", element.getFirstChild().getNodeValue() );
 
     }
 
-
     /**
-     * Tests simple fragment construction, using the {@link #TEST_XML}
-     * XML input data.
+     * Tests simple fragment construction, using the {@link #TEST_XML} XML input data.
      */
     @Test
     public void testDocumentFragment()
-        throws SAXException, ParserConfigurationException, IOException {
+        throws SAXException, ParserConfigurationException, IOException
+    {
 
-        digester.addRule("root",
-                         new NodeCreateRule(Node.DOCUMENT_FRAGMENT_NODE));
-        DocumentFragment fragment = digester.parse(new StringReader(TEST_XML));
+        digester.addRule( "root", new NodeCreateRule( Node.DOCUMENT_FRAGMENT_NODE ) );
+        DocumentFragment fragment = digester.parse( new StringReader( TEST_XML ) );
 
-        assertNotNull(fragment);
-        assertEquals(4, fragment.getChildNodes().getLength());
+        assertNotNull( fragment );
+        assertEquals( 4, fragment.getChildNodes().getLength() );
 
         Node rootBody = fragment.getFirstChild();
-        assertEquals(Node.TEXT_NODE, rootBody.getNodeType());
-        assertEquals("ROOT BODY", rootBody.getNodeValue());
+        assertEquals( Node.TEXT_NODE, rootBody.getNodeType() );
+        assertEquals( "ROOT BODY", rootBody.getNodeValue() );
 
-        Node alpha = fragment.getChildNodes().item(1);
-        assertEquals(Node.ELEMENT_NODE, alpha.getNodeType());
-        assertEquals("alpha", alpha.getNodeName());
-        assertNull(((Element)alpha).getLocalName());
-        assertNull(((Element)alpha).getNamespaceURI());
-        assertEquals(1, alpha.getChildNodes().getLength());
-        assertEquals("ALPHA BODY", alpha.getFirstChild().getNodeValue());
-
-        Node beta = fragment.getChildNodes().item(2);
-        assertEquals(Node.ELEMENT_NODE, beta.getNodeType());
-        assertEquals("beta", beta.getNodeName());
-        assertNull(((Element)beta).getLocalName());
-        assertNull(((Element)beta).getNamespaceURI());
-        assertEquals(1, beta.getChildNodes().getLength());
-        assertEquals("BETA BODY", beta.getFirstChild().getNodeValue());
-
-        Node gamma = fragment.getChildNodes().item(3);
-        assertEquals(Node.ELEMENT_NODE, gamma.getNodeType());
-        assertEquals("gamma", gamma.getNodeName());
-        assertNull(((Element)gamma).getLocalName());
-        assertNull(((Element)gamma).getNamespaceURI());
-        assertEquals(1, gamma.getChildNodes().getLength());
-        assertEquals("GAMMA BODY", gamma.getFirstChild().getNodeValue());
+        Node alpha = fragment.getChildNodes().item( 1 );
+        assertEquals( Node.ELEMENT_NODE, alpha.getNodeType() );
+        assertEquals( "alpha", alpha.getNodeName() );
+        assertNull( ( (Element) alpha ).getLocalName() );
+        assertNull( ( (Element) alpha ).getNamespaceURI() );
+        assertEquals( 1, alpha.getChildNodes().getLength() );
+        assertEquals( "ALPHA BODY", alpha.getFirstChild().getNodeValue() );
+
+        Node beta = fragment.getChildNodes().item( 2 );
+        assertEquals( Node.ELEMENT_NODE, beta.getNodeType() );
+        assertEquals( "beta", beta.getNodeName() );
+        assertNull( ( (Element) beta ).getLocalName() );
+        assertNull( ( (Element) beta ).getNamespaceURI() );
+        assertEquals( 1, beta.getChildNodes().getLength() );
+        assertEquals( "BETA BODY", beta.getFirstChild().getNodeValue() );
+
+        Node gamma = fragment.getChildNodes().item( 3 );
+        assertEquals( Node.ELEMENT_NODE, gamma.getNodeType() );
+        assertEquals( "gamma", gamma.getNodeName() );
+        assertNull( ( (Element) gamma ).getLocalName() );
+        assertNull( ( (Element) gamma ).getNamespaceURI() );
+        assertEquals( 1, gamma.getChildNodes().getLength() );
+        assertEquals( "GAMMA BODY", gamma.getFirstChild().getNodeValue() );
 
     }
 
-
     /**
-     * Tests whether control is returned to digester after fragment
-     * construction.
+     * Tests whether control is returned to digester after fragment construction.
      */
     @Test
     public void testNested()
-        throws SAXException, ParserConfigurationException, IOException {
+        throws SAXException, ParserConfigurationException, IOException
+    {
 
-        digester.addObjectCreate("root", ArrayList.class);
-        digester.addRule("root/a/b",
-                         new NodeCreateRule(Node.DOCUMENT_FRAGMENT_NODE));
-        digester.addSetRoot("root/a/b", "add");
-        digester.addObjectCreate("root/b", String.class);
-        digester.addSetRoot("root/b", "add");
-        List<?> list = digester.parse(getInputStream("Test4.xml"));
+        digester.addObjectCreate( "root", ArrayList.class );
+        digester.addRule( "root/a/b", new NodeCreateRule( Node.DOCUMENT_FRAGMENT_NODE ) );
+        digester.addSetRoot( "root/a/b", "add" );
+        digester.addObjectCreate( "root/b", String.class );
+        digester.addSetRoot( "root/b", "add" );
+        List<?> list = digester.parse( getInputStream( "Test4.xml" ) );
 
-        assertNotNull(list);
-        assertEquals(2, list.size());
+        assertNotNull( list );
+        assertEquals( 2, list.size() );
 
-        assertTrue(list.get(0) instanceof DocumentFragment);
-        DocumentFragment fragment = (DocumentFragment)list.get(0);
+        assertTrue( list.get( 0 ) instanceof DocumentFragment );
+        DocumentFragment fragment = (DocumentFragment) list.get( 0 );
 
-        assertEquals(Node.ELEMENT_NODE,
-                     fragment.getFirstChild().getNodeType());
-        Element a = (Element)fragment.getFirstChild();
-        assertEquals("a", a.getNodeName());
-        assertEquals(1, a.getAttributes().getLength());
-        assertEquals("THREE", a.getAttribute("name"));
+        assertEquals( Node.ELEMENT_NODE, fragment.getFirstChild().getNodeType() );
+        Element a = (Element) fragment.getFirstChild();
+        assertEquals( "a", a.getNodeName() );
+        assertEquals( 1, a.getAttributes().getLength() );
+        assertEquals( "THREE", a.getAttribute( "name" ) );
 
-        assertTrue(list.get(1) instanceof String);
+        assertTrue( list.get( 1 ) instanceof String );
 
     }
 
-
     /**
-     * Tests whether attributes are correctly imported into the fragment, using
-     * the example in the Test1 XML file.
+     * Tests whether attributes are correctly imported into the fragment, using the example in the Test1 XML file.
      */
     @Test
     public void testAttributes()
-        throws SAXException, ParserConfigurationException, IOException {
+        throws SAXException, ParserConfigurationException, IOException
+    {
 
-        digester.addRule("employee",
-                         new NodeCreateRule(Node.DOCUMENT_FRAGMENT_NODE));
-        DocumentFragment fragment = digester.parse(getInputStream("Test1.xml"));
+        digester.addRule( "employee", new NodeCreateRule( Node.DOCUMENT_FRAGMENT_NODE ) );
+        DocumentFragment fragment = digester.parse( getInputStream( "Test1.xml" ) );
 
-        assertNotNull(fragment);
-        assertEquals(2, fragment.getChildNodes().getLength());
+        assertNotNull( fragment );
+        assertEquals( 2, fragment.getChildNodes().getLength() );
 
-        assertEquals(Node.ELEMENT_NODE, fragment.getFirstChild().getNodeType());
-        Element address1 = (Element)fragment.getFirstChild();
-        assertEquals("address", address1.getNodeName());
-        assertEquals(5, address1.getAttributes().getLength());
-        assertEquals("home", address1.getAttribute("type"));
-        assertEquals("Home Street", address1.getAttribute("street"));
-        assertEquals("Home City", address1.getAttribute("city"));
-        assertEquals("HS", address1.getAttribute("state"));
-        assertEquals("HmZip", address1.getAttribute("zipCode"));
-
-        assertEquals(Node.ELEMENT_NODE, fragment.getLastChild().getNodeType());
-        Element address2 = (Element)fragment.getLastChild();
-        assertEquals("address", address2.getNodeName());
-        assertEquals(5, address2.getAttributes().getLength());
-        assertEquals("office", address2.getAttribute("type"));
-        assertEquals("Office Street", address2.getAttribute("street"));
-        assertEquals("Office City", address2.getAttribute("city"));
-        assertEquals("OS", address2.getAttribute("state"));
-        assertEquals("OfZip", address2.getAttribute("zipCode"));
+        assertEquals( Node.ELEMENT_NODE, fragment.getFirstChild().getNodeType() );
+        Element address1 = (Element) fragment.getFirstChild();
+        assertEquals( "address", address1.getNodeName() );
+        assertEquals( 5, address1.getAttributes().getLength() );
+        assertEquals( "home", address1.getAttribute( "type" ) );
+        assertEquals( "Home Street", address1.getAttribute( "street" ) );
+        assertEquals( "Home City", address1.getAttribute( "city" ) );
+        assertEquals( "HS", address1.getAttribute( "state" ) );
+        assertEquals( "HmZip", address1.getAttribute( "zipCode" ) );
+
+        assertEquals( Node.ELEMENT_NODE, fragment.getLastChild().getNodeType() );
+        Element address2 = (Element) fragment.getLastChild();
+        assertEquals( "address", address2.getNodeName() );
+        assertEquals( 5, address2.getAttributes().getLength() );
+        assertEquals( "office", address2.getAttribute( "type" ) );
+        assertEquals( "Office Street", address2.getAttribute( "street" ) );
+        assertEquals( "Office City", address2.getAttribute( "city" ) );
+        assertEquals( "OS", address2.getAttribute( "state" ) );
+        assertEquals( "OfZip", address2.getAttribute( "zipCode" ) );
 
     }
 
-
     /**
-     * Tests whether namespaces are handled correctly, using the example from 
-     * the file Test3 XML file.
+     * Tests whether namespaces are handled correctly, using the example from the file Test3 XML file.
      */
     @Test
     public void testNamespaces()
-        throws SAXException, ParserConfigurationException, IOException {
+        throws SAXException, ParserConfigurationException, IOException
+    {
 
-        digester.setNamespaceAware(true);
-        digester.setRuleNamespaceURI(null);
-        digester.addRule("employee",
-                         new NodeCreateRule(Node.DOCUMENT_FRAGMENT_NODE));
-        DocumentFragment fragment = digester.parse(getInputStream("Test3.xml"));
-
-        assertNotNull(fragment);
-        assertEquals(2, fragment.getChildNodes().getLength());
-
-        assertEquals(Node.ELEMENT_NODE, fragment.getFirstChild().getNodeType());
-        Element address1 = (Element)fragment.getFirstChild();
-        assertEquals("address", address1.getNodeName());
-        assertEquals("http://commons.apache.org/digester/Bar",
-                     address1.getNamespaceURI());
-        assertEquals("address", address1.getLocalName());
-        assertEquals(5, address1.getAttributes().getLength());
-        assertEquals("home", address1.getAttribute("type"));
-        assertEquals("Home Street", address1.getAttribute("street"));
-        assertEquals("Home City", address1.getAttribute("city"));
-        assertEquals("HS", address1.getAttribute("state"));
-        assertEquals("HmZip", address1.getAttribute("zipCode"));
-
-        assertEquals(Node.ELEMENT_NODE, fragment.getLastChild().getNodeType());
-        Element address2 = (Element)fragment.getLastChild();
-        assertEquals("address", address2.getNodeName());
-        assertEquals("http://commons.apache.org/digester/Bar",
-                     address2.getNamespaceURI());
-        assertEquals("address", address2.getLocalName());
-        assertEquals(5, address2.getAttributes().getLength());
-        assertEquals("office", address2.getAttribute("type"));
-        assertEquals("Office Street", address2.getAttribute("street"));
-        assertEquals("Office City", address2.getAttribute("city"));
-        assertEquals("OS", address2.getAttribute("state"));
-        assertEquals("OfZip", address2.getAttribute("zipCode"));
+        digester.setNamespaceAware( true );
+        digester.setRuleNamespaceURI( null );
+        digester.addRule( "employee", new NodeCreateRule( Node.DOCUMENT_FRAGMENT_NODE ) );
+        DocumentFragment fragment = digester.parse( getInputStream( "Test3.xml" ) );
+
+        assertNotNull( fragment );
+        assertEquals( 2, fragment.getChildNodes().getLength() );
+
+        assertEquals( Node.ELEMENT_NODE, fragment.getFirstChild().getNodeType() );
+        Element address1 = (Element) fragment.getFirstChild();
+        assertEquals( "address", address1.getNodeName() );
+        assertEquals( "http://commons.apache.org/digester/Bar", address1.getNamespaceURI() );
+        assertEquals( "address", address1.getLocalName() );
+        assertEquals( 5, address1.getAttributes().getLength() );
+        assertEquals( "home", address1.getAttribute( "type" ) );
+        assertEquals( "Home Street", address1.getAttribute( "street" ) );
+        assertEquals( "Home City", address1.getAttribute( "city" ) );
+        assertEquals( "HS", address1.getAttribute( "state" ) );
+        assertEquals( "HmZip", address1.getAttribute( "zipCode" ) );
+
+        assertEquals( Node.ELEMENT_NODE, fragment.getLastChild().getNodeType() );
+        Element address2 = (Element) fragment.getLastChild();
+        assertEquals( "address", address2.getNodeName() );
+        assertEquals( "http://commons.apache.org/digester/Bar", address2.getNamespaceURI() );
+        assertEquals( "address", address2.getLocalName() );
+        assertEquals( 5, address2.getAttributes().getLength() );
+        assertEquals( "office", address2.getAttribute( "type" ) );
+        assertEquals( "Office Street", address2.getAttribute( "street" ) );
+        assertEquals( "Office City", address2.getAttribute( "city" ) );
+        assertEquals( "OS", address2.getAttribute( "state" ) );
+        assertEquals( "OfZip", address2.getAttribute( "zipCode" ) );
 
     }
 
     /**
-     * Tests whether namespaced attributes are handled correctly, using the example from 
-     * the file Test10 XML file.
+     * Tests whether namespaced attributes are handled correctly, using the example from the file Test10 XML file.
      */
     @Test
     public void testNamespacedAttribute()
-        throws SAXException, ParserConfigurationException, IOException {
-        
-        digester.setNamespaceAware(true);
-        digester.setRuleNamespaceURI(null);
-        digester.addRule("employee",
-                         new NodeCreateRule(Node.ELEMENT_NODE));
-        Element element = digester.parse(getInputStream("Test10.xml"));
-
-        assertNotNull(element);
-        
-        assertNotNull(element.getAttributeNodeNS("http://commons.apache.org/digester/Bar", "test"));
-        assertEquals("MyTestAttribute", element.getAttributeNodeNS("http://commons.apache.org/digester/Bar", "test").getNodeValue());
-        assertEquals("test", element.getAttributeNodeNS("http://commons.apache.org/digester/Bar", "test").getLocalName());
-        assertEquals("bar", element.getAttributeNodeNS("http://commons.apache.org/digester/Bar", "test").getPrefix());
-        assertEquals("bar:test", element.getAttributeNodeNS("http://commons.apache.org/digester/Bar", "test").getName());
+        throws SAXException, ParserConfigurationException, IOException
+    {
+
+        digester.setNamespaceAware( true );
+        digester.setRuleNamespaceURI( null );
+        digester.addRule( "employee", new NodeCreateRule( Node.ELEMENT_NODE ) );
+        Element element = digester.parse( getInputStream( "Test10.xml" ) );
+
+        assertNotNull( element );
+
+        assertNotNull( element.getAttributeNodeNS( "http://commons.apache.org/digester/Bar", "test" ) );
+        assertEquals( "MyTestAttribute",
+                      element.getAttributeNodeNS( "http://commons.apache.org/digester/Bar", "test" ).getNodeValue() );
+        assertEquals( "test",
+                      element.getAttributeNodeNS( "http://commons.apache.org/digester/Bar", "test" ).getLocalName() );
+        assertEquals( "bar", element.getAttributeNodeNS( "http://commons.apache.org/digester/Bar", "test" ).getPrefix() );
+        assertEquals( "bar:test",
+                      element.getAttributeNodeNS( "http://commons.apache.org/digester/Bar", "test" ).getName() );
+
+    }
 
-    }      
-    
     /**
-     * Tests whether non-namespaced attributes are handled correctly, using the example from 
-     * the file Test11 XML file.
+     * Tests whether non-namespaced attributes are handled correctly, using the example from the file Test11 XML file.
      */
     @Test
     public void testNonNamespacedAttribute()
-        throws SAXException, ParserConfigurationException, IOException {
-        
-        digester.setNamespaceAware(true);
-        digester.setRuleNamespaceURI(null);
-        digester.addRule("employee",
-                         new NodeCreateRule(Node.ELEMENT_NODE));
-        Element element = digester.parse(getInputStream("Test10.xml"));
-
-        assertNotNull(element);
-        
-        assertNotNull(element.getAttributeNode("firstName"));
-        assertEquals("First Name", element.getAttributeNode("firstName").getNodeValue());
-        assertEquals("firstName", element.getAttributeNode("firstName").getLocalName());
-        assertEquals(null, element.getAttributeNode("firstName").getPrefix());
-        assertEquals("firstName", element.getAttributeNode("firstName").getName());
+        throws SAXException, ParserConfigurationException, IOException
+    {
+
+        digester.setNamespaceAware( true );
+        digester.setRuleNamespaceURI( null );
+        digester.addRule( "employee", new NodeCreateRule( Node.ELEMENT_NODE ) );
+        Element element = digester.parse( getInputStream( "Test10.xml" ) );
 
-    }     
+        assertNotNull( element );
+
+        assertNotNull( element.getAttributeNode( "firstName" ) );
+        assertEquals( "First Name", element.getAttributeNode( "firstName" ).getNodeValue() );
+        assertEquals( "firstName", element.getAttributeNode( "firstName" ).getLocalName() );
+        assertEquals( null, element.getAttributeNode( "firstName" ).getPrefix() );
+        assertEquals( "firstName", element.getAttributeNode( "firstName" ).getName() );
+
+    }
 
     /**
-     * Tests whether the created fragment can be imported into an existing 
-     * document.
+     * Tests whether the created fragment can be imported into an existing document.
      */
     @Test
     public void testImport()
-        throws SAXException, ParserConfigurationException, IOException {
+        throws SAXException, ParserConfigurationException, IOException
+    {
 
-        digester.addRule("root",
-                         new NodeCreateRule(Node.DOCUMENT_FRAGMENT_NODE));
-        DocumentFragment fragment = digester.parse(new StringReader(TEST_XML));
+        digester.addRule( "root", new NodeCreateRule( Node.DOCUMENT_FRAGMENT_NODE ) );
+        DocumentFragment fragment = digester.parse( new StringReader( TEST_XML ) );
 
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         DocumentBuilder builder = factory.newDocumentBuilder();
         Document doc = builder.newDocument();
-        Node importedFragment = doc.importNode(fragment, true);
-        doc.appendChild(doc.createElement("root"));
-        doc.getFirstChild().appendChild(importedFragment);
+        Node importedFragment = doc.importNode( fragment, true );
+        doc.appendChild( doc.createElement( "root" ) );
+        doc.getFirstChild().appendChild( importedFragment );
 
     }
 
     /**
-     * This unit test checks that text nodes are correctly created when
-     * xml entities are used. In particular, this usually causes the xml
-     * parser to make multiple invocations of the characters(..) sax
-     * callback, rather than just one.
+     * This unit test checks that text nodes are correctly created when xml entities are used. In particular, this
+     * usually causes the xml parser to make multiple invocations of the characters(..) sax callback, rather than just
+     * one.
      */
     @Test
-    public void testEntityText() throws Exception {
-        String TEST_XML2 =
-            "<?xml version='1.0'?><root><alpha>&#65; &#65;</alpha></root>";
-
-        digester.addRule("root/alpha", new NodeCreateRule());
-        Element element = digester.parse(new StringReader(TEST_XML2));
-
-        assertNotNull(element);
-        assertEquals("alpha", element.getNodeName());
-        assertNull(element.getLocalName());
-        assertNull(element.getNamespaceURI());
-        assertEquals(1, element.getChildNodes().getLength());
-        assertEquals("A A", element.getFirstChild().getNodeValue());
+    public void testEntityText()
+        throws Exception
+    {
+        String TEST_XML2 = "<?xml version='1.0'?><root><alpha>&#65; &#65;</alpha></root>";
+
+        digester.addRule( "root/alpha", new NodeCreateRule() );
+        Element element = digester.parse( new StringReader( TEST_XML2 ) );
+
+        assertNotNull( element );
+        assertEquals( "alpha", element.getNodeName() );
+        assertNull( element.getLocalName() );
+        assertNull( element.getNamespaceURI() );
+        assertEquals( 1, element.getChildNodes().getLength() );
+        assertEquals( "A A", element.getFirstChild().getNodeValue() );
     }
-    // ------------------------------------------------ Utility Support Methods
 
+    // ------------------------------------------------ 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 ) );
 
     }
 
-
 }

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectCreationFactoryTestImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectCreationFactoryTestImpl.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectCreationFactoryTestImpl.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectCreationFactoryTestImpl.java Thu May 12 18:03:26 2011
@@ -16,7 +16,6 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
 import org.apache.commons.digester3.AbstractObjectCreationFactory;
@@ -25,21 +24,22 @@ import org.xml.sax.helpers.AttributesImp
 
 /**
  * Object creation factory used for testing.
- *
+ * 
  * @author Robert Burrell Donkin
  */
 
-public class ObjectCreationFactoryTestImpl extends AbstractObjectCreationFactory {
+public class ObjectCreationFactoryTestImpl
+    extends AbstractObjectCreationFactory
+{
     public boolean called = false;
+
     public Attributes attributes;
-    
+
     @Override
-    public Object createObject(Attributes attributes) {
-        this.attributes = new AttributesImpl(attributes);
+    public Object createObject( Attributes attributes )
+    {
+        this.attributes = new AttributesImpl( attributes );
         called = true;
         return this;
     }
 }
-
-
-

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectParamRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectParamRuleTestCase.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectParamRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectParamRuleTestCase.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;
@@ -35,96 +33,91 @@ import org.junit.Before;
 import org.junit.Test;
 import org.xml.sax.SAXException;
 
-
 /**
- * <p>Tests for the <code>ObjectParamRuleTestCase</code>
- *
+ * <p>
+ * Tests for the <code>ObjectParamRuleTestCase</code>
+ * 
  * @author Mark Huisman
  */
-public class ObjectParamRuleTestCase {
-
+public class ObjectParamRuleTestCase
+{
 
     // ----------------------------------------------------- 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
 
-    private StringBuilder sb = new StringBuilder().
-        append("<arraylist><A/><B/><C/><D desc=\"the fourth\"/><E/></arraylist>");
-
+    private StringBuilder sb =
+        new StringBuilder().append( "<arraylist><A/><B/><C/><D desc=\"the fourth\"/><E/></arraylist>" );
 
     /**
-     * Test method calls with the ObjectParamRule rule.  It should be possible to
-     * pass any subclass of Object as a parameter, provided that either the element
-     * or the element + attribute has been matched.
+     * Test method calls with the ObjectParamRule rule. It should be possible to pass any subclass of Object as a
+     * parameter, provided that either the element or the element + attribute has been matched.
      */
     @Test
-    public void testBasic() throws SAXException, IOException {
+    public void testBasic()
+        throws SAXException, IOException
+    {
 
         // Configure the digester as required
-        digester.addObjectCreate("arraylist", ArrayList.class);
+        digester.addObjectCreate( "arraylist", ArrayList.class );
 
         // Test adding a variety of objects
-        digester.addCallMethod("arraylist/A", "add", 1);
-        ObjectParamRule opr = new ObjectParamRule(0, new Integer(-9));
-        digester.addRule("arraylist/A", opr);
-        digester.addCallMethod("arraylist/B", "add", 1);
-        opr = new ObjectParamRule(0, new Float(3.14159));
-        digester.addRule("arraylist/B", opr);
-        digester.addCallMethod("arraylist/C", "add", 1);
-        opr = new ObjectParamRule(0, new Long(999999999));
-        digester.addRule("arraylist/C", opr);
-        digester.addCallMethod("arraylist/D", "add", 1);
-        opr = new ObjectParamRule(0, "desc", new String("foobarbazbing"));
-        digester.addRule("arraylist/D", opr);
+        digester.addCallMethod( "arraylist/A", "add", 1 );
+        ObjectParamRule opr = new ObjectParamRule( 0, new Integer( -9 ) );
+        digester.addRule( "arraylist/A", opr );
+        digester.addCallMethod( "arraylist/B", "add", 1 );
+        opr = new ObjectParamRule( 0, new Float( 3.14159 ) );
+        digester.addRule( "arraylist/B", opr );
+        digester.addCallMethod( "arraylist/C", "add", 1 );
+        opr = new ObjectParamRule( 0, new Long( 999999999 ) );
+        digester.addRule( "arraylist/C", opr );
+        digester.addCallMethod( "arraylist/D", "add", 1 );
+        opr = new ObjectParamRule( 0, "desc", new String( "foobarbazbing" ) );
+        digester.addRule( "arraylist/D", opr );
         // note that this will add a null parameter to the method call and will
         // not be added to the arraylist.
-        digester.addCallMethod("arraylist/E", "add", 1);
-        opr = new ObjectParamRule(0, "nonexistentattribute", new String("ignore"));
-        digester.addRule("arraylist/E", opr);
-
-        //Parse it and obtain the ArrayList
-        ArrayList<?> al = digester.parse(new StringReader(sb.toString()));
-        assertNotNull(al);
-        assertEquals(al.size(), 4);
-        assertTrue(al.contains(new Integer(-9)));
-        assertTrue(al.contains(new Float(3.14159)));
-        assertTrue(al.contains(new Long(999999999)));
-        assertTrue(al.contains(new String("foobarbazbing")));
-        assertTrue(!(al.contains(new String("ignore"))));
+        digester.addCallMethod( "arraylist/E", "add", 1 );
+        opr = new ObjectParamRule( 0, "nonexistentattribute", new String( "ignore" ) );
+        digester.addRule( "arraylist/E", opr );
+
+        // Parse it and obtain the ArrayList
+        ArrayList<?> al = digester.parse( new StringReader( sb.toString() ) );
+        assertNotNull( al );
+        assertEquals( al.size(), 4 );
+        assertTrue( al.contains( new Integer( -9 ) ) );
+        assertTrue( al.contains( new Float( 3.14159 ) ) );
+        assertTrue( al.contains( new Long( 999999999 ) ) );
+        assertTrue( al.contains( new String( "foobarbazbing" ) ) );
+        assertTrue( !( al.contains( new String( "ignore" ) ) ) );
     }
 
 }
-

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/OtherTestObjectCreationFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/OtherTestObjectCreationFactory.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/OtherTestObjectCreationFactory.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/OtherTestObjectCreationFactory.java Thu May 12 18:03:26 2011
@@ -16,17 +16,15 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 /**
  * Another Object creation factory used for testing.
- *
+ * 
  * @author Robert Burrell Donkin
  */
 
-public class OtherTestObjectCreationFactory extends ObjectCreationFactoryTestImpl {}
-
-
-
+public class OtherTestObjectCreationFactory
+    extends ObjectCreationFactoryTestImpl
+{
+}

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/OverlappingCallMethodRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/OverlappingCallMethodRuleTestCase.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/OverlappingCallMethodRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/OverlappingCallMethodRuleTestCase.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 java.io.IOException;
@@ -30,95 +28,109 @@ import org.junit.Test;
 import org.xml.sax.SAXException;
 
 /**
- * <p>Tests for situations where CallMethodRule instances and their
- * parameters overlap each other.</p>
+ * <p>
+ * Tests for situations where CallMethodRule instances and their parameters overlap each other.
+ * </p>
  */
-public class OverlappingCallMethodRuleTestCase {
-
+public class OverlappingCallMethodRuleTestCase
+{
 
     // --------------------------------------------------- Overall Test Methods
 
     String itemId;
+
     String itemName;
-    
-    public void setItemId(String id) { itemId = id; }
-    public void setItemName(String name) { itemName = name; }
-    
+
+    public void setItemId( String id )
+    {
+        itemId = id;
+    }
+
+    public void setItemName( String name )
+    {
+        itemName = name;
+    }
+
     // ------------------------------------------------ Individual Test Methods
 
     @Test
-    public void testItem1() throws SAXException, IOException {
+    public void testItem1()
+        throws SAXException, IOException
+    {
         StringBuilder input = new StringBuilder();
-        input.append("<root>");
-        input.append(" <item id='1'>anitem</item>");
-        input.append("</root>");
+        input.append( "<root>" );
+        input.append( " <item id='1'>anitem</item>" );
+        input.append( "</root>" );
 
         Digester digester = new Digester();
-        
-        digester.addCallMethod("root/item", "setItemId", 1);
-        digester.addCallParam("root/item", 0, "id");
-        digester.addCallMethod("root/item", "setItemName", 1);
-        digester.addCallParam("root/item", 0);
+
+        digester.addCallMethod( "root/item", "setItemId", 1 );
+        digester.addCallParam( "root/item", 0, "id" );
+        digester.addCallMethod( "root/item", "setItemName", 1 );
+        digester.addCallParam( "root/item", 0 );
 
         this.itemId = null;
         this.itemName = null;
-        digester.push(this);
-        digester.parse(new StringReader(input.toString()));
+        digester.push( this );
+        digester.parse( new StringReader( input.toString() ) );
 
-        assertEquals("1", this.itemId);
-        assertEquals("anitem", this.itemName);
+        assertEquals( "1", this.itemId );
+        assertEquals( "anitem", this.itemName );
     }
 
     @Test
-    public void testItem2() throws SAXException, IOException {
+    public void testItem2()
+        throws SAXException, IOException
+    {
         StringBuilder input = new StringBuilder();
-        input.append("<root>");
-        input.append(" <item id='1'>anitem</item>");
-        input.append("</root>");
+        input.append( "<root>" );
+        input.append( " <item id='1'>anitem</item>" );
+        input.append( "</root>" );
 
         Digester digester = new Digester();
 
-        digester.addCallMethod("root/item", "setItemName", 1);
-        digester.addCallParam("root/item", 0);
-        digester.addCallMethod("root/item", "setItemId", 1);
-        digester.addCallParam("root/item", 0, "id");
+        digester.addCallMethod( "root/item", "setItemName", 1 );
+        digester.addCallParam( "root/item", 0 );
+        digester.addCallMethod( "root/item", "setItemId", 1 );
+        digester.addCallParam( "root/item", 0, "id" );
 
         this.itemId = null;
         this.itemName = null;
-        digester.push(this);
-        digester.parse(new StringReader(input.toString()));
+        digester.push( this );
+        digester.parse( new StringReader( input.toString() ) );
 
-        assertEquals("1", this.itemId);
-        assertEquals("anitem", this.itemName);
+        assertEquals( "1", this.itemId );
+        assertEquals( "anitem", this.itemName );
     }
 
     @Test
-    public void testItem3() throws SAXException, IOException {
+    public void testItem3()
+        throws SAXException, IOException
+    {
         StringBuilder input = new StringBuilder();
-        input.append("<root>");
-        input.append(" <item>1</item>");
-        input.append("</root>");
+        input.append( "<root>" );
+        input.append( " <item>1</item>" );
+        input.append( "</root>" );
 
         Digester digester = new Digester();
 
-        digester.addCallMethod("root/item", "setItemId", 1);
-        digester.addCallParam("root/item", 0);
-        digester.addCallMethod("root/item", "setItemName", 1);
-        digester.addCallParam("root/item", 0);
+        digester.addCallMethod( "root/item", "setItemId", 1 );
+        digester.addCallParam( "root/item", 0 );
+        digester.addCallMethod( "root/item", "setItemName", 1 );
+        digester.addCallParam( "root/item", 0 );
 
         this.itemId = null;
         this.itemName = null;
-        digester.push(this);
-        digester.parse(new StringReader(input.toString()));
+        digester.push( this );
+        digester.parse( new StringReader( input.toString() ) );
 
-        assertEquals("1", this.itemId);
-        assertEquals("1", this.itemName);
+        assertEquals( "1", this.itemId );
+        assertEquals( "1", this.itemName );
     }
 
     /**
-     * This is an "anti-test" that demonstrates how digester can <i>fails</i> 
-     * to produce the correct results, due to a design flaw (or at least
-     * limitation) in the way that CallMethodRule and CallParamRule work. 
+     * This is an "anti-test" that demonstrates how digester can <i>fails</i> to produce the correct results, due to a
+     * design flaw (or at least limitation) in the way that CallMethodRule and CallParamRule work.
      * <p>
      * The following sequence always fails:
      * <ul>
@@ -127,110 +139,111 @@ public class OverlappingCallMethodRuleTe
      * <li>params rule for A fires --> writes to params of method B!</li>
      * <li>params rule for B fires --> overwrites params for method B</li>
      * </ul>
-     * The result is that method "b" appears to work ok, but method "a"
-     * loses its input parameters.
+     * The result is that method "b" appears to work ok, but method "a" loses its input parameters.
      * <p>
-     * One solution is for CallParamRule objects to know which CallMethodRule
-     * they are associated with. Even this might fail in corner cases where
-     * the same rule is associated with multiple patterns, or with wildcard
-     * patterns which cause a rule to fire in a "recursive" manner. However
-     * implementing this is not possible with the current digester design.
+     * One solution is for CallParamRule objects to know which CallMethodRule they are associated with. Even this might
+     * fail in corner cases where the same rule is associated with multiple patterns, or with wildcard patterns which
+     * cause a rule to fire in a "recursive" manner. However implementing this is not possible with the current digester
+     * design.
      */
     @Test
-    public void testItem4() throws SAXException, IOException {
-        StringBuilder input = new StringBuilder();
-        input.append("<root>");
-        input.append(" <item>");
-        input.append("  <id value='1'/>");
-        input.append("  <name value='name'/>");
-        input.append(" </item>");
-        input.append("</root>");
+    public void testItem4()
+        throws SAXException, IOException
+    {
+        StringBuilder input = new StringBuilder();
+        input.append( "<root>" );
+        input.append( " <item>" );
+        input.append( "  <id value='1'/>" );
+        input.append( "  <name value='name'/>" );
+        input.append( " </item>" );
+        input.append( "</root>" );
 
         Digester digester = new Digester();
 
-        digester.addCallMethod("root/item", "setItemId", 1);
-        digester.addCallParam("root/item/id", 0, "value");
-        digester.addCallMethod("root/item", "setItemName", 1);
-        digester.addCallParam("root/item/name", 0, "value");
+        digester.addCallMethod( "root/item", "setItemId", 1 );
+        digester.addCallParam( "root/item/id", 0, "value" );
+        digester.addCallMethod( "root/item", "setItemName", 1 );
+        digester.addCallParam( "root/item/name", 0, "value" );
 
         this.itemId = null;
         this.itemName = null;
-        digester.push(this);
-        digester.parse(new StringReader(input.toString()));
+        digester.push( this );
+        digester.parse( new StringReader( input.toString() ) );
 
         // These are the "correct" results
-        //assertEquals("1", this.itemId);
-        //assertEquals("name", this.itemName);
+        // assertEquals("1", this.itemId);
+        // assertEquals("name", this.itemName);
 
         // These are what actually happens
-        assertEquals(null, this.itemId);
-        assertEquals("name", this.itemName);
+        assertEquals( null, this.itemId );
+        assertEquals( "name", this.itemName );
     }
 
     /**
-     * This test checks that CallParamRule instances which fetch data
-     * from xml attributes work ok when invoked "recursively",
-     * ie a rule instances' methods gets called in the order
+     * This test checks that CallParamRule instances which fetch data from xml attributes work ok when invoked
+     * "recursively", ie a rule instances' methods gets called in the order
      * begin[1]/begin[2]/body[2]/end[2]/body[1]/end[1]
      */
     @Test
-    public void testWildcard1() throws SAXException, IOException {
-        StringBuilder input = new StringBuilder();
-        input.append("<box id='A1'>");
-        input.append(" <box id='B1'>");
-        input.append("  <box id='C1'/>");
-        input.append("  <box id='C2'/>");
-        input.append(" </box>");
-        input.append("</box>");
+    public void testWildcard1()
+        throws SAXException, IOException
+    {
+        StringBuilder input = new StringBuilder();
+        input.append( "<box id='A1'>" );
+        input.append( " <box id='B1'>" );
+        input.append( "  <box id='C1'/>" );
+        input.append( "  <box id='C2'/>" );
+        input.append( " </box>" );
+        input.append( "</box>" );
 
         Digester digester = new Digester();
 
-        digester.addObjectCreate("*/box", Box.class);
-        digester.addCallMethod("*/box", "setId", 1);
-        digester.addCallParam("*/box", 0, "id");
-        digester.addSetNext("*/box", "addChild");
+        digester.addObjectCreate( "*/box", Box.class );
+        digester.addCallMethod( "*/box", "setId", 1 );
+        digester.addCallParam( "*/box", 0, "id" );
+        digester.addSetNext( "*/box", "addChild" );
 
         Box root = new Box();
-        root.setId("root");
-        digester.push(root);
-        digester.parse(new StringReader(input.toString()));
+        root.setId( "root" );
+        digester.push( root );
+        digester.parse( new StringReader( input.toString() ) );
 
         // walk the object tree, concatenating the id strings
         String ids = root.getIds();
-        assertEquals("root A1 B1 C1 C2", ids);
+        assertEquals( "root A1 B1 C1 C2", ids );
     }
 
     /**
-     * This test checks that CallParamRule instances which fetch data
-     * from the xml element body work ok when invoked "recursively",
-     * ie a rule instances' methods gets called in the order
+     * This test checks that CallParamRule instances which fetch data from the xml element body work ok when invoked
+     * "recursively", ie a rule instances' methods gets called in the order
      * begin[1]/begin[2]/body[2]/end[2]/body[1]/end[1]
      */
     @Test
-    public void testWildcard2() throws SAXException, IOException {
-        StringBuilder input = new StringBuilder();
-        input.append("<box>A1");
-        input.append(" <box>B1");
-        input.append("  <box>C1</box>");
-        input.append("  <box>C2</box>");
-        input.append(" </box>");
-        input.append("</box>");
+    public void testWildcard2()
+        throws SAXException, IOException
+    {
+        StringBuilder input = new StringBuilder();
+        input.append( "<box>A1" );
+        input.append( " <box>B1" );
+        input.append( "  <box>C1</box>" );
+        input.append( "  <box>C2</box>" );
+        input.append( " </box>" );
+        input.append( "</box>" );
 
         Digester digester = new Digester();
 
-        digester.addObjectCreate("*/box", Box.class);
-        digester.addCallMethod("*/box", "setId", 1);
-        digester.addCallParam("*/box", 0);
-        digester.addSetNext("*/box", "addChild");
+        digester.addObjectCreate( "*/box", Box.class );
+        digester.addCallMethod( "*/box", "setId", 1 );
+        digester.addCallParam( "*/box", 0 );
+        digester.addSetNext( "*/box", "addChild" );
 
         Box root = new Box();
-        root.setId("root");
-        digester.push(root);
-        digester.parse(new StringReader(input.toString()));
+        root.setId( "root" );
+        digester.push( root );
+        digester.parse( new StringReader( input.toString() ) );
 
         // walk the object tree, concatenating the id strings
         String ids = root.getIds();
-        assertEquals("root A1 B1 C1 C2", ids);
+        assertEquals( "root A1 B1 C1 C2", ids );
     }
 }
-

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ParamBean.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ParamBean.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ParamBean.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ParamBean.java Thu May 12 18:03:26 2011
@@ -18,38 +18,46 @@
 
 package org.apache.commons.digester3;
 
-
-/** 
- * This bean is used to replicate a reasonably complex use case 
- * whose behaviour has changed from Digester 1.3 to 1.4.
- *
+/**
+ * This bean is used to replicate a reasonably complex use case whose behaviour has changed from Digester 1.3 to 1.4.
+ * 
  * @author robert burrell donkin
  */
-public class ParamBean {
-    
+public class ParamBean
+{
+
     private boolean cool;
+
     private String that;
+
     private String _this;
-    
-    public ParamBean() {}
-    
-    public boolean isCool() {
+
+    public ParamBean()
+    {
+    }
+
+    public boolean isCool()
+    {
         return cool;
     }
-    
-    public void setCool(boolean cool) {
+
+    public void setCool( boolean cool )
+    {
         this.cool = cool;
     }
-    
-    public String getThis() {
+
+    public String getThis()
+    {
         return _this;
     }
-    
-    public String getThat() {
+
+    public String getThat()
+    {
         return that;
     }
-    
-    public String setThisAndThat(String _this, String that) {
+
+    public String setThisAndThat( String _this, String that )
+    {
         this._this = _this;
         this.that = that;
         return "The Other";

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/PrimitiveBean.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/PrimitiveBean.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/PrimitiveBean.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/PrimitiveBean.java Thu May 12 18:03:26 2011
@@ -18,35 +18,40 @@
 
 package org.apache.commons.digester3;
 
-
-/** 
- * A simple bean with primitive properties.
- * At the moment only need a boolean property.
- * Feel free to add others later.
- *
+/**
+ * A simple bean with primitive properties. At the moment only need a boolean property. Feel free to add others later.
+ * 
  * @author robert burrell donkin
  */
-public class PrimitiveBean {
-    
+public class PrimitiveBean
+{
+
     private boolean booleanValue;
+
     private boolean setBooleanCalled;
-    
-    public PrimitiveBean() {}
-    
-    public boolean getBoolean() {
+
+    public PrimitiveBean()
+    {
+    }
+
+    public boolean getBoolean()
+    {
         return booleanValue;
     }
-    
-    public boolean getSetBooleanCalled() {
+
+    public boolean getSetBooleanCalled()
+    {
         return setBooleanCalled;
     }
 
-    public void setBoolean(boolean booleanValue) {
+    public void setBoolean( boolean booleanValue )
+    {
         this.booleanValue = booleanValue;
         setBooleanCalled = true;
     }
-    
-    public void testSetBoolean(String ignored, boolean booleanValue) {
-        setBoolean(booleanValue);
+
+    public void testSetBoolean( String ignored, boolean booleanValue )
+    {
+        setBoolean( booleanValue );
     }
 }

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/RegexRulesTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/RegexRulesTestCase.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/RegexRulesTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/RegexRulesTestCase.java Thu May 12 18:03:26 2011
@@ -30,206 +30,182 @@ import org.junit.Test;
 
 /**
  * Test case for RegexRules
- *
+ * 
  * @author Robert Burrell Donkin
  * @version $Revision$ $Date$
  */
 
-public class RegexRulesTestCase {
-    
+public class RegexRulesTestCase
+{
+
     /** Test regex that matches everything */
     @Test
-    public void testMatchAll() {
+    public void testMatchAll()
+    {
         // set up which should match every rule
-        RegexRules rules = new RegexRules(
-            new RegexMatcher() {
-                @Override
-                public boolean match(String pathPattern, String rulePattern) {
-                    return true;
-                }
-            });
-        
-        rules.add("/a/b/b", new TestRule("alpha"));
-        rules.add("/a/d", new TestRule("beta"));
-        rules.add("/b", new TestRule("gamma"));
-        
+        RegexRules rules = new RegexRules( new RegexMatcher()
+        {
+            @Override
+            public boolean match( String pathPattern, String rulePattern )
+            {
+                return true;
+            }
+        } );
+
+        rules.add( "/a/b/b", new TestRule( "alpha" ) );
+        rules.add( "/a/d", new TestRule( "beta" ) );
+        rules.add( "/b", new TestRule( "gamma" ) );
+
         // now test a few patterns
         // check that all are return in the order which they were added
-        List<Rule> matches = rules.match("", "x/g/e");
-        assertEquals("Wrong number of rules returned (1)", 3, matches.size());
-        assertEquals("Rule Out Of Order (1)", "alpha", ((TestRule) matches.get(0)).getIdentifier());
-        assertEquals("Rule Out Of Order (2)", "beta", ((TestRule) matches.get(1)).getIdentifier());
-        assertEquals("Rule Out Of Order (3)", "gamma", ((TestRule) matches.get(2)).getIdentifier());
-        
-        matches = rules.match("", "/a");
-        assertEquals("Wrong number of rules returned (2)", 3, matches.size());
-        assertEquals("Rule Out Of Order (4)", "alpha", ((TestRule) matches.get(0)).getIdentifier());
-        assertEquals("Rule Out Of Order (5)", "beta", ((TestRule) matches.get(1)).getIdentifier());
-        assertEquals("Rule Out Of Order (6)", "gamma", ((TestRule) matches.get(2)).getIdentifier());        
+        List<Rule> matches = rules.match( "", "x/g/e" );
+        assertEquals( "Wrong number of rules returned (1)", 3, matches.size() );
+        assertEquals( "Rule Out Of Order (1)", "alpha", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
+        assertEquals( "Rule Out Of Order (2)", "beta", ( (TestRule) matches.get( 1 ) ).getIdentifier() );
+        assertEquals( "Rule Out Of Order (3)", "gamma", ( (TestRule) matches.get( 2 ) ).getIdentifier() );
+
+        matches = rules.match( "", "/a" );
+        assertEquals( "Wrong number of rules returned (2)", 3, matches.size() );
+        assertEquals( "Rule Out Of Order (4)", "alpha", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
+        assertEquals( "Rule Out Of Order (5)", "beta", ( (TestRule) matches.get( 1 ) ).getIdentifier() );
+        assertEquals( "Rule Out Of Order (6)", "gamma", ( (TestRule) matches.get( 2 ) ).getIdentifier() );
     }
-    
+
     /** Test regex matcher that matches nothing */
     @Test
-    public void testMatchNothing() {
+    public void testMatchNothing()
+    {
         // set up which should match every rule
-        RegexRules rules = new RegexRules(
-            new RegexMatcher() {
-                @Override
-                public boolean match(String pathPattern, String rulePattern) {
-                    return false;
-                }
-            });
-        
-        rules.add("/b/c/f", new TestRule("alpha"));
-        rules.add("/c/f", new TestRule("beta"));
-        rules.add("/b", new TestRule("gamma"));
-        
+        RegexRules rules = new RegexRules( new RegexMatcher()
+        {
+            @Override
+            public boolean match( String pathPattern, String rulePattern )
+            {
+                return false;
+            }
+        } );
+
+        rules.add( "/b/c/f", new TestRule( "alpha" ) );
+        rules.add( "/c/f", new TestRule( "beta" ) );
+        rules.add( "/b", new TestRule( "gamma" ) );
+
         // now test a few patterns
         // check that all are return in the order which they were added
-        List<Rule> matches = rules.match("", "/b/c");
-        assertEquals("Wrong number of rules returned (1)", 0, matches.size());
-        
-        matches = rules.match("", "/b/c/f");
-        assertEquals("Wrong number of rules returned (2)", 0, matches.size());
+        List<Rule> matches = rules.match( "", "/b/c" );
+        assertEquals( "Wrong number of rules returned (1)", 0, matches.size() );
+
+        matches = rules.match( "", "/b/c/f" );
+        assertEquals( "Wrong number of rules returned (2)", 0, matches.size() );
     }
 
     /** Test a mixed regex - in other words, one that sometimes returns true and sometimes false */
     @Test
-    public void testMatchMixed() {
+    public void testMatchMixed()
+    {
         // set up which should match every rule
-        RegexRules rules = new RegexRules(
-            new RegexMatcher() {
-                @Override
-                public boolean match(String pathPattern, String rulePattern) {
-                    return (rulePattern.equals("/match/me"));
-                }
-            });
-        
-        rules.add("/match", new TestRule("alpha"));
-        rules.add("/match/me", new TestRule("beta"));
-        rules.add("/match", new TestRule("gamma"));
-        
+        RegexRules rules = new RegexRules( new RegexMatcher()
+        {
+            @Override
+            public boolean match( String pathPattern, String rulePattern )
+            {
+                return ( rulePattern.equals( "/match/me" ) );
+            }
+        } );
+
+        rules.add( "/match", new TestRule( "alpha" ) );
+        rules.add( "/match/me", new TestRule( "beta" ) );
+        rules.add( "/match", new TestRule( "gamma" ) );
+
         // now test a few patterns
         // check that all are return in the order which they were added
-        List<Rule> matches = rules.match("", "/match");
-        assertEquals("Wrong number of rules returned (1)", 1, matches.size());
-        assertEquals("Wrong Rule (1)", "beta", ((TestRule) matches.get(0)).getIdentifier());
-        
-        matches = rules.match("", "/a/match");
-        assertEquals("Wrong Rule (2)", "beta", ((TestRule) matches.get(0)).getIdentifier());
+        List<Rule> matches = rules.match( "", "/match" );
+        assertEquals( "Wrong number of rules returned (1)", 1, matches.size() );
+        assertEquals( "Wrong Rule (1)", "beta", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
+
+        matches = rules.match( "", "/a/match" );
+        assertEquals( "Wrong Rule (2)", "beta", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
     }
-        
+
     /** Test rules and clear methods */
     @Test
-    public void testClear() {
+    public void testClear()
+    {
         // set up which should match every rule
-        RegexRules rules = new RegexRules(
-            new RegexMatcher() {
-                @Override
-                public boolean match(String pathPattern, String rulePattern) {
-                    return true;
-                }
-            });
-        
-        rules.add("/abba", new TestRule("alpha"));
-        rules.add("/ad/ma", new TestRule("beta"));
-        rules.add("/gamma", new TestRule("gamma"));
-        
+        RegexRules rules = new RegexRules( new RegexMatcher()
+        {
+            @Override
+            public boolean match( String pathPattern, String rulePattern )
+            {
+                return true;
+            }
+        } );
+
+        rules.add( "/abba", new TestRule( "alpha" ) );
+        rules.add( "/ad/ma", new TestRule( "beta" ) );
+        rules.add( "/gamma", new TestRule( "gamma" ) );
+
         // check that rules returns all rules in the order which they were added
         List<Rule> matches = rules.rules();
-        assertEquals("Wrong number of rules returned (1)", 3, matches.size());
-        assertEquals("Rule Out Of Order (1)", "alpha", ((TestRule) matches.get(0)).getIdentifier());
-        assertEquals("Rule Out Of Order (2)", "beta", ((TestRule) matches.get(1)).getIdentifier());
-        assertEquals("Rule Out Of Order (3)", "gamma", ((TestRule) matches.get(2)).getIdentifier());
-        
-        matches = rules.match("", "/eggs");
-        assertEquals("Wrong number of rules returned (2)", 3, matches.size());
-        assertEquals("Rule Out Of Order (4)", "alpha", ((TestRule) matches.get(0)).getIdentifier());
-        assertEquals("Rule Out Of Order (5)", "beta", ((TestRule) matches.get(1)).getIdentifier());
-        assertEquals("Rule Out Of Order (6)", "gamma", ((TestRule) matches.get(2)).getIdentifier());
-        
+        assertEquals( "Wrong number of rules returned (1)", 3, matches.size() );
+        assertEquals( "Rule Out Of Order (1)", "alpha", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
+        assertEquals( "Rule Out Of Order (2)", "beta", ( (TestRule) matches.get( 1 ) ).getIdentifier() );
+        assertEquals( "Rule Out Of Order (3)", "gamma", ( (TestRule) matches.get( 2 ) ).getIdentifier() );
+
+        matches = rules.match( "", "/eggs" );
+        assertEquals( "Wrong number of rules returned (2)", 3, matches.size() );
+        assertEquals( "Rule Out Of Order (4)", "alpha", ( (TestRule) matches.get( 0 ) ).getIdentifier() );
+        assertEquals( "Rule Out Of Order (5)", "beta", ( (TestRule) matches.get( 1 ) ).getIdentifier() );
+        assertEquals( "Rule Out Of Order (6)", "gamma", ( (TestRule) matches.get( 2 ) ).getIdentifier() );
+
         rules.clear();
         matches = rules.rules();
-        assertEquals("Wrong number of rules returned (3)", 0, matches.size());
-        
-        matches = rules.match("", "/eggs");
-        assertEquals("Wrong number of rules returned (4)", 0, matches.size());
+        assertEquals( "Wrong number of rules returned (3)", 0, matches.size() );
+
+        matches = rules.match( "", "/eggs" );
+        assertEquals( "Wrong number of rules returned (4)", 0, matches.size() );
     }
 
     @Test
-    public void testSimpleRegexMatch() {
-        
+    public void testSimpleRegexMatch()
+    {
+
         SimpleRegexMatcher matcher = new SimpleRegexMatcher();
-        
-//        SimpleLog log = new SimpleLog("{testSimpleRegexMatch:SimpleRegexMatcher]");
-//        log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
-        
-        
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma", "/alpha/beta/gamma"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma/epsilon' ", 
-                false, 
-                matcher.match("/alpha/beta/gamma", "/alpha/beta/gamma/epsilon"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma", "/alpha/*"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*/gamma' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma", "/alpha/*/gamma"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*me' ", 
-                false, 
-                matcher.match("/alpha/beta/gamma", "/alpha/*me"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '*/beta/gamma' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma", "*/beta/gamma"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '*/alpha/beta/gamma' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma", "*/alpha/beta/gamma"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '*/bet/gamma' ", 
-                false, 
-                matcher.match("/alpha/beta/gamma", "*/bet/gamma"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to 'alph?/beta/gamma' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma", "/alph?/beta/gamma"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '/?lpha/beta/gamma' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma", "/?lpha/beta/gamma"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '/alpha/?beta/gamma' ", 
-                false, 
-                matcher.match("/alpha/beta/gamma", "/alpha/?beta/gamma"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '/alpha/?eta/*' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma", "/alpha/?eta/*"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '/alpha/?eta/*e' ", 
-                false, 
-                matcher.match("/alpha/beta/gamma", "/alpha/?eta/*e"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma' to '*/?et?/?amma' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma", "*/?et?/?amma"));
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma/beta/epsilon/beta/gamma/epsilon' to "
-                + " '*/beta/gamma/?p*n' ", 
-                true, 
-                matcher.match("/alpha/beta/gamma/beta/epsilon/beta/gamma/epsilon", "*/beta/gamma/?p*n"));     
-        assertEquals(
-                "Simple Regex Match '/alpha/beta/gamma/beta/epsilon/beta/gamma/epsilon' to "
-                + " '*/beta/gamma/?p*no' ", 
-                false, 
-                matcher.match("/alpha/beta/gamma", "*/beta/gamma/?p*no"));  
+
+        // SimpleLog log = new SimpleLog("{testSimpleRegexMatch:SimpleRegexMatcher]");
+        // log.setLevel(SimpleLog.LOG_LEVEL_TRACE);
+
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma' ", true,
+                      matcher.match( "/alpha/beta/gamma", "/alpha/beta/gamma" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/beta/gamma/epsilon' ", false,
+                      matcher.match( "/alpha/beta/gamma", "/alpha/beta/gamma/epsilon" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*' ", true,
+                      matcher.match( "/alpha/beta/gamma", "/alpha/*" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*/gamma' ", true,
+                      matcher.match( "/alpha/beta/gamma", "/alpha/*/gamma" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/*me' ", false,
+                      matcher.match( "/alpha/beta/gamma", "/alpha/*me" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '*/beta/gamma' ", true,
+                      matcher.match( "/alpha/beta/gamma", "*/beta/gamma" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '*/alpha/beta/gamma' ", true,
+                      matcher.match( "/alpha/beta/gamma", "*/alpha/beta/gamma" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '*/bet/gamma' ", false,
+                      matcher.match( "/alpha/beta/gamma", "*/bet/gamma" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to 'alph?/beta/gamma' ", true,
+                      matcher.match( "/alpha/beta/gamma", "/alph?/beta/gamma" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/?lpha/beta/gamma' ", true,
+                      matcher.match( "/alpha/beta/gamma", "/?lpha/beta/gamma" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/?beta/gamma' ", false,
+                      matcher.match( "/alpha/beta/gamma", "/alpha/?beta/gamma" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/?eta/*' ", true,
+                      matcher.match( "/alpha/beta/gamma", "/alpha/?eta/*" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '/alpha/?eta/*e' ", false,
+                      matcher.match( "/alpha/beta/gamma", "/alpha/?eta/*e" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma' to '*/?et?/?amma' ", true,
+                      matcher.match( "/alpha/beta/gamma", "*/?et?/?amma" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma/beta/epsilon/beta/gamma/epsilon' to "
+                          + " '*/beta/gamma/?p*n' ", true,
+                      matcher.match( "/alpha/beta/gamma/beta/epsilon/beta/gamma/epsilon", "*/beta/gamma/?p*n" ) );
+        assertEquals( "Simple Regex Match '/alpha/beta/gamma/beta/epsilon/beta/gamma/epsilon' to "
+            + " '*/beta/gamma/?p*no' ", false, matcher.match( "/alpha/beta/gamma", "*/beta/gamma/?p*no" ) );
     }
 }



Mime
View raw message