You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sk...@apache.org on 2005/02/07 09:04:15 UTC

svn commit: r151708 - jakarta/commons/proper/digester/branches/digester2/src/test/org/apache/commons/digester2/DigesterTestCase.java

Author: skitching
Date: Mon Feb  7 00:04:15 2005
New Revision: 151708

URL: http://svn.apache.org/viewcvs?view=rev&rev=151708
Log:
Add test for setInitialObject.
Change assertEquals to assertSame where appropriate.

Modified:
    jakarta/commons/proper/digester/branches/digester2/src/test/org/apache/commons/digester2/DigesterTestCase.java

Modified: jakarta/commons/proper/digester/branches/digester2/src/test/org/apache/commons/digester2/DigesterTestCase.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/digester/branches/digester2/src/test/org/apache/commons/digester2/DigesterTestCase.java?view=diff&r1=151707&r2=151708
==============================================================================
--- jakarta/commons/proper/digester/branches/digester2/src/test/org/apache/commons/digester2/DigesterTestCase.java (original)
+++ jakarta/commons/proper/digester/branches/digester2/src/test/org/apache/commons/digester2/DigesterTestCase.java Mon Feb  7 00:04:15 2005
@@ -125,7 +125,7 @@
         SAXHandler h = new SAXHandler();
         Digester d = new Digester(h);
 
-        assertEquals("Constructor with SAXHandler", d.getSAXHandler(), h);
+        assertSame("Constructor with SAXHandler", d.getSAXHandler(), h);
     }
 
     /**
@@ -285,6 +285,26 @@
 
     // TODO: add tests for various parse methods
 
+    /**
+     * Test that setInitialObject works.
+     */
+    public void testInitialObject() throws Exception {
+        // TODO: verify that Action classes see the initial object as
+        // the root object on the stack...
+        
+        String inputText = "<root/>";
+        InputSource source = new InputSource(new StringReader(inputText));
+
+        Object initial = new Object();
+        
+        // Create the digester
+        Digester d = new Digester();
+        d.setInitialObject(initial);
+        d.parse(source);
+        
+        assertSame("Initial object is root", initial, d.getRoot());
+    }
+    
     // TODO: add test for setInitialObject and getRoot
 
     /**
@@ -298,7 +318,7 @@
         // check we can set and get a custom error handler
         assertNull("Initial error handler is null", d.getErrorHandler());
         d.setErrorHandler(defaultHandler);
-        assertEquals("Set/get error handler failed",
+        assertSame("Set/get error handler failed",
             defaultHandler, d.getErrorHandler());
 
         d.setErrorHandler(null);



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org