FileDocCategorySizeDatePackage
JUnitTestSuiteAdapter.javaAPI DocAndroid 1.5 API2086Wed May 06 22:41:04 BST 2009org.w3c.domts

JUnitTestSuiteAdapter

public class JUnitTestSuiteAdapter extends TestSuite implements DOMTestSink

Fields Summary
private DOMTestSuite
test
Constructors Summary
public JUnitTestSuiteAdapter(DOMTestSuite test)

    super(test.getTargetURI());
    this.test = test;
    test.build(this);
  
Methods Summary
public voidaddTest(java.lang.Class testclass)

    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();
      }
    }