Skip to content

Commit 72cd8fb

Browse files
committed
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.
1 parent fc53e39 commit 72cd8fb

2 files changed

Lines changed: 12 additions & 18 deletions

File tree

build.xml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,8 @@ Authors:
822822
<batchtest fork="yes" todir="test-reports">
823823
<fileset dir="${build.dir}/classes">
824824
<include name="dom/DTest.class"/>
825-
<include name="dom/dom3/Test.class"/>
825+
<include name="dom/dom3/Test.class"/>
826+
<include name="dom/registry/Test.class"/>
826827
<include name="dom/traversal/*Test.class"/>
827828
<include name="dom/range/TestCompare.class"/>
828829
<include name="idc/IDConstraintTests.class"/>
@@ -968,12 +969,6 @@ Authors:
968969
classpathref="test.classpath"
969970
failOnError="yes">
970971
</java>
971-
<echo message="Running dom.registry.Test..." />
972-
<java fork="yes"
973-
classname="dom.registry.Test"
974-
classpathref="test.classpath"
975-
failOnError="yes">
976-
</java>
977972

978973
</target>
979974

tests/dom/registry/Test.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@
2323
import org.w3c.dom.DOMImplementation;
2424
import org.w3c.dom.bootstrap.DOMImplementationRegistry;
2525

26-
import dom.util.Assertion;
26+
import junit.framework.TestCase;
2727

28-
public class Test {
28+
public class Test extends TestCase {
2929

30-
public static void main(String argv[])
31-
{
32-
30+
public void testRegistry()
31+
{
3332
System.out.println("Running dom.registry.Test...");
3433
// set DOMImplementationSource
3534
System.setProperty(DOMImplementationRegistry.PROPERTY,
@@ -39,30 +38,30 @@ public static void main(String argv[])
3938
DOMImplementationRegistry registry = null;
4039
try {
4140
registry = DOMImplementationRegistry.newInstance();
42-
Assertion.verify(registry != null);
41+
assertNotNull("registry should not be null", registry);
4342
} catch (Exception e) {
44-
e.printStackTrace();
43+
fail("Unexpected exception: " + e.getMessage());
4544
}
4645

4746
try {
4847
DOMImplementation i = registry.getDOMImplementation("XML");
4948

50-
Assertion.verify(i ==
49+
assertSame(i,
5150
CoreDOMImplementationImpl.getDOMImplementation());
5251

5352
} catch (Exception e) {
54-
e.printStackTrace();
53+
fail("Unexpected exception: " + e.getMessage());
5554
}
5655

5756
try {
5857
DOMImplementation i =
5958
registry.getDOMImplementation("XML MutationEvents");
6059

61-
Assertion.verify(i ==
60+
assertSame(i,
6261
DOMImplementationImpl.getDOMImplementation());
6362

6463
} catch (Exception e) {
65-
e.printStackTrace();
64+
fail("Unexpected exception: " + e.getMessage());
6665
}
6766
}
6867
}

0 commit comments

Comments
 (0)