You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2026/07/07 21:24:34 UTC

(xerces-j) 01/01: Convert dom.registry.Test to JUnit 3

This is an automated email from the ASF dual-hosted git repository.

elharo pushed a commit to branch convert-registry-to-junit
in repository https://gitbox.apache.org/repos/asf/xerces-j.git

commit 72cd8fbafa4aeb10a8ddfff110c018df3682eedd
Author: Elliotte Rusty Harold <el...@ibiblio.org>
AuthorDate: Tue Jul 7 21:23:57 2026 +0000

    Convert dom.registry.Test to JUnit 3
    
    - Extend TestCase and replace Assertion.verify with JUnit assertions
    - Add to batchtest and remove old java task in build.xml
    
    Part of XERCESJ-1796.
---
 build.xml                    |  9 ++-------
 tests/dom/registry/Test.java | 21 ++++++++++-----------
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/build.xml b/build.xml
index 3a3cba4cb..d50f9b330 100644
--- a/build.xml
+++ b/build.xml
@@ -822,7 +822,8 @@ Authors:
         <batchtest fork="yes" todir="test-reports">
           <fileset dir="${build.dir}/classes">
              <include name="dom/DTest.class"/>                    
-             <include name="dom/dom3/Test.class"/>                    
+             <include name="dom/dom3/Test.class"/>
+             <include name="dom/registry/Test.class"/>                    
              <include name="dom/traversal/*Test.class"/>                    
              <include name="dom/range/TestCompare.class"/>                    
              <include name="idc/IDConstraintTests.class"/>                    
@@ -968,12 +969,6 @@ Authors:
           classpathref="test.classpath"
           failOnError="yes">
     </java>
-    <echo message="Running dom.registry.Test..." />
-    <java fork="yes"
-          classname="dom.registry.Test"
-          classpathref="test.classpath"
-          failOnError="yes">
-    </java>
 
   </target>
 
diff --git a/tests/dom/registry/Test.java b/tests/dom/registry/Test.java
index 090372938..f59f3983d 100644
--- a/tests/dom/registry/Test.java
+++ b/tests/dom/registry/Test.java
@@ -23,13 +23,12 @@ import org.apache.xerces.dom.DOMImplementationImpl;
 import org.w3c.dom.DOMImplementation;
 import org.w3c.dom.bootstrap.DOMImplementationRegistry;
 
-import dom.util.Assertion;
+import junit.framework.TestCase;
 
-public class Test {
+public class Test extends TestCase {
 
-    public static void main(String argv[])
-    {                                  
-        
+    public void testRegistry()
+    {
         System.out.println("Running dom.registry.Test...");
         // set DOMImplementationSource
         System.setProperty(DOMImplementationRegistry.PROPERTY,
@@ -39,30 +38,30 @@ public class Test {
         DOMImplementationRegistry registry = null;
         try {
             registry = DOMImplementationRegistry.newInstance();
-            Assertion.verify(registry != null);
+            assertNotNull("registry should not be null", registry);
         } catch (Exception e) {
-            e.printStackTrace();
+            fail("Unexpected exception: " + e.getMessage());
         }
 
         try {
             DOMImplementation i = registry.getDOMImplementation("XML");
 
-            Assertion.verify(i ==
+            assertSame(i,
                              CoreDOMImplementationImpl.getDOMImplementation());
 
         } catch (Exception e) {
-            e.printStackTrace();
+            fail("Unexpected exception: " + e.getMessage());
         }
 
         try {
             DOMImplementation i =
                 registry.getDOMImplementation("XML MutationEvents");
 
-            Assertion.verify(i ==
+            assertSame(i,
                              DOMImplementationImpl.getDOMImplementation());
 
         } catch (Exception e) {
-            e.printStackTrace();
+            fail("Unexpected exception: " + e.getMessage());
         }
     }
 }    


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org