|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
TestXMLSwingSet.java | 0% | 62.5% | 66.7% | 53.8% |
|
1 |
package swingset;
|
|
2 |
|
|
3 |
import demo.SwingSet;
|
|
4 |
|
|
5 |
import junit.extensions.xml.XMLTestSuite;
|
|
6 |
import junit.extensions.xml.XMLUtil;
|
|
7 |
import junit.framework.Test;
|
|
8 |
import junit.textui.TestRunner;
|
|
9 |
|
|
10 |
/**
|
|
11 |
* A class written as an example of how to use the jfcUnit
|
|
12 |
* framework. This class is used to "test" the SwingSet demo
|
|
13 |
* shipped with JDK 1.2.2
|
|
14 |
*
|
|
15 |
* @author <a href="mailto:vraravam@thoughtworks.com">Vijay Aravamudhan : ThoughtWorks Inc.</a>
|
|
16 |
*/
|
|
17 |
public class TestXMLSwingSet extends XMLTestSuite { |
|
18 |
|
|
19 |
/** Document factory key. */
|
|
20 |
public static final String DOCUMENT_FACTORY = "javax.xml.parsers.DocumentBuilderFactory"; |
|
21 |
|
|
22 |
/**
|
|
23 |
* Construct a TestXMLSwingSet().
|
|
24 |
* Use testSwingSet.xml as the XML test definition.
|
|
25 |
*/
|
|
26 | 1 |
public TestXMLSwingSet() {
|
27 | 1 |
super("testSwingSet.xml", XMLUtil.readFileFromClassContext(TestXMLSwingSet.class, "testSwingSet.xml")); |
28 | 1 |
SwingSet.main(new String[] {});
|
29 | 1 |
try {
|
30 | 1 |
Thread.currentThread().sleep(3000); |
31 |
} catch (Exception e) {
|
|
32 |
; // Ignore
|
|
33 |
} |
|
34 |
} |
|
35 |
|
|
36 |
/**
|
|
37 |
* Create a test suite for this object.
|
|
38 |
* @return Test Suite of tests to be executed.
|
|
39 |
*/
|
|
40 | 1 |
public static Test suite() { |
41 | 1 |
return new TestXMLSwingSet(); |
42 |
} |
|
43 |
|
|
44 |
/**
|
|
45 |
* Main method to run this class from the command line.
|
|
46 |
* Use the internal parse if available otherwise use the
|
|
47 |
* xerces parser.
|
|
48 |
*
|
|
49 |
* @param args Command line arguments.
|
|
50 |
*/
|
|
51 | 0 |
public static void main(final String[] args) { |
52 |
// Java 1.4 should already be configured for XML.
|
|
53 |
// Or if the user has configured the property use the
|
|
54 |
// Existing property. Otherwise we will assume, that
|
|
55 |
// the Xerces parser will be used.
|
|
56 | 0 |
if (System.getProperty(DOCUMENT_FACTORY) == null) { |
57 | 0 |
System.setProperty(DOCUMENT_FACTORY, |
58 |
"org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
|
|
59 |
} |
|
60 | 0 |
TestRunner.run((Test) TestXMLSwingSet.suite()); |
61 |
} |
|
62 |
} |
|
63 |
|
|