in testing/dom-testsuite/src/main/java/org/apache/axiom/ts/dom/w3c/W3CDOMTestSuiteBuilder.java [48:112]
protected final void addTests() {
final DOMTestDocumentBuilderFactory factory;
try {
factory =
new DOMTestDocumentBuilderFactoryImpl(
dbff,
new DocumentBuilderSetting[] {
DocumentBuilderSetting.notCoalescing,
DocumentBuilderSetting.notExpandEntityReferences,
DocumentBuilderSetting.notIgnoringElementContentWhitespace,
DocumentBuilderSetting.namespaceAware,
DocumentBuilderSetting.notValidating
});
} catch (DOMTestIncompatibleException ex) {
// TODO
throw new Error(ex);
}
DOMTestSuite suite;
try {
suite = createDOMTestSuite(factory);
} catch (Exception ex) {
// TODO
throw new Error(ex);
}
suite.build(
new DOMTestSink() {
@Override
public void addTest(Class testClass) {
try {
if (!unsupportedFeatures.isEmpty()) {
Set<DOMFeature> usedFeatures = new HashSet<DOMFeature>();
DOMFeature.matchFeatures(testClass, usedFeatures);
ClassReader classReader =
new ClassReader(
testClass.getResourceAsStream(
testClass.getSimpleName() + ".class"));
DOMTSClassVisitor cv = new DOMTSClassVisitor(usedFeatures);
classReader.accept(
cv, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
usedFeatures.retainAll(unsupportedFeatures);
if (!usedFeatures.isEmpty()) {
return;
}
}
Constructor<? extends DOMTestCase> testConstructor =
((Class<?>) testClass)
.asSubclass(DOMTestCase.class)
.getConstructor(DOMTestDocumentBuilderFactory.class);
DOMTestCase test;
try {
test = testConstructor.newInstance(new Object[] {factory});
} catch (InvocationTargetException ex) {
throw ex.getTargetException();
}
test.setFramework(JUnitTestFramework.INSTANCE);
W3CDOMTestSuiteBuilder.this.addTest(new W3CTestCase(test));
} catch (Throwable ex) {
// TODO
throw new Error(ex);
}
}
});
}