1 | public static TestSuite createFailureExpectedSuite(Class testClass) {↵ | | 1 | public static TestSuite createFailureExpectedSuite(Class testClass) {↵
|
2 | ↵ | | |
|
3 | ↵ | | |
|
| | | 2 | ↵
|
4 | TestSuite allTests = new TestSuite(testClass);↵ | | 3 | TestSuite allTests = new TestSuite(testClass);
↵
|
5 | Set failureExpected = new HashSet();↵ | | 4 | Set failureExpected = new HashSet();↵
|
6 | ↵ | | |
|
7 | Enumeration tests = allTests.tests();↵ | | 5 | Enumeration tests = allTests.tests();↵
|
8 | ↵ | | |
|
9 | while (tests.hasMoreElements()) {↵ | | 6 | while (tests.hasMoreElements()) {↵
|
10 | ↵ | | |
|
11 | Test t = (Test) tests.nextElement();↵ | | 7 | Test t = (Test) tests.nextElement();↵
|
12 | ↵ | | |
|
13 | if (t instanceof TestCase) {↵ | | 8 | if (t instanceof TestCase) {↵
|
14 | ↵ | | |
|
15 | String name = ((TestCase) t).getName();↵ | | 9 | String name = ((TestCase) t).getName();↵
|
16 | ↵ | | |
|
17 | if (name.endsWith("FailureExpected"))↵ | | 10 | if (name.endsWith("FailureExpected"))↵
|
18 | ↵ | | |
|
19 | failureExpected.add(name);↵ | | 11 | failureExpected.add(name);↵
|
20 | ↵ | | |
|
21 | } ↵ | | 12 | } ↵
|
22 | }↵ | | |
|
23 | ↵ | | |
|
24 | ↵ | | |
|
| | | 13 | }↵
|
| | | 14 | ↵
|
25 | TestSuite result = new TestSuite();↵ | | 15 | TestSuite result = new TestSuite();
↵
|
26 | tests = allTests.tests();↵ | | 16 | tests = allTests.tests();
↵
|
27 | while (tests.hasMoreElements()) {↵ | | 17 | while (tests.hasMoreElements()) {
↵
|
28 | Test t = (Test) tests.nextElement();↵ | | 18 | Test t = (Test) tests.nextElement();
↵
|
29 | if (t instanceof TestCase) {↵ | | 19 | if (t instanceof TestCase) {
↵
|
30 | String name = ((TestCase) t).getName();↵ | | 20 | String name = ((TestCase) t).getName();
↵
|
31 | if (!failureExpected.contains(name + "FailureExpected")) {↵ | | 21 | if (!failureExpected.contains(name + "FailureExpected")) {
↵
|
32 | result.addTest(t);↵ | | 22 | result.addTest(t);
↵
|
33 | }↵ | | 23 | }
↵
|
34 | } ↵ | | 24 | }
↵
|
35 | }↵ | | 25 | }↵
|
36 | ↵ | | |
|
37 | ↵ | | |
|
| | | 26 | ↵
|
38 | return result;↵ | | 27 | return result;↵
|
39 | | | |
|
| | | 28 |
|