1 /* 2 * Copyright (c) 2001-2004 World Wide Web Consortium, 3 * (Massachusetts Institute of Technology, Institut National de 4 * Recherche en Informatique et en Automatique, Keio University). All 5 * Rights Reserved. This program is distributed under the W3C's Software 6 * Intellectual Property License. This program is distributed in the 7 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even 8 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 9 * PURPOSE. 10 * See W3C License http://www.w3.org/Consortium/Legal/ for more details. 11 */ 12 package org.w3c.domts.level3.core; 13 import java.lang.reflect.Constructor; 14 15 import junit.framework.TestSuite; 16 17 import org.w3c.domts.BatikTestDocumentBuilderFactory; 18 import org.w3c.domts.DOMTestDocumentBuilderFactory; 19 import org.w3c.domts.DOMTestSuite; 20 import org.w3c.domts.DocumentBuilderSetting; 21 import org.w3c.domts.JUnitTestSuiteAdapter; 22 23 /** 24 * 25 * Runs test suite using Batik SVG. 26 * 27 */ 28 public class TestBatik extends TestSuite { 29 /** 30 * Factory method for suite. 31 * 32 * @return suite 33 * @throws Exception if Batik is not available or could not be instantiated 34 */ 35 public static TestSuite suite() throws Exception { 36 Class testClass = ClassLoader.getSystemClassLoader().loadClass( 37 "org.w3c.domts.level3.core.alltests"); 38 Constructor testConstructor = testClass 39 .getConstructor(new Class[]{DOMTestDocumentBuilderFactory.class}); 40 DOMTestDocumentBuilderFactory factory = new BatikTestDocumentBuilderFactory( 41 new DocumentBuilderSetting[0]); 42 Object test = testConstructor.newInstance(new Object[]{factory}); 43 return new JUnitTestSuiteAdapter((DOMTestSuite) test); 44 } 45 } 46