DOMTestDocumentBuilderFactory factory = test.getFactory();
try {
Constructor testConstructor = testclass.getConstructor(
new Class[] { DOMTestDocumentBuilderFactory.class } );
//
// since this is done with reflection
// any exception on construction is wrapped with
// an InvocationTargetException and must be unwrapped
Object domtest;
try {
domtest = testConstructor.newInstance(new Object[] { factory });
} catch(InvocationTargetException ex) {
throw ex.getTargetException();
}
if(domtest instanceof DOMTestCase) {
TestCase test = new JUnitTestCaseAdapter((DOMTestCase) domtest);
addTest(test);
}
else {
if(domtest instanceof DOMTestSuite) {
TestSuite test = new JUnitTestSuiteAdapter((DOMTestSuite) domtest);
addTest(test);
}
}
}
catch(Throwable ex) {
if(!(ex instanceof DOMTestIncompatibleException)) {
ex.printStackTrace();
}
}