1 /***
2 * TestRegistry
3 *
4 * This class basically stores as a Registry for JUnit tests.
5 */
6
7 package junit.quilt.framework;
8
9 import java.util.*;
10 import junit.framework.*;
11 import junit.quilt.util.*;
12
13 public class TestRegistry extends Registry {
14 private static TestRegistry _instance =
15 new TestRegistry();
16
17 private TestRegistry() {
18 super( "All Tests" );
19 }
20
21 public static TestRegistry getInstance() {
22 return _instance;
23 }
24
25 public void addTest( String args[], Test test ) {
26 register( args, test );
27 }
28
29 public void addSuite( TestSuite suite ) {
30 String args[] = new String[2];
31 String suiteArgs[] = new String[1];
32
33 args[0] = suite.getName();
34 suiteArgs[1] = suite.getName();
35 register( suiteArgs, suite );
36
37 Enumeration tests = suite.tests();
38 while (tests.hasMoreElements()) {
39 Test test = (Test) tests.nextElement();
40
41 if (test instanceof TestCase) {
42 args[1] = ((TestCase) test).getName();
43 } else {
44 args[1] = test.toString();
45 }
46
47 register( args, test );
48 }
49 }
50
51 }
This page was automatically generated by Maven