|
1 |
| package com.agical.rmock.extension.junit; |
|
2 |
| |
|
3 |
| import junit.framework.Test; |
|
4 |
| import junit.framework.TestSuite; |
|
5 |
| |
|
6 |
| import com.agical.rmock.core.find.MatchAction; |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| public class AddToTestSuiteAction implements MatchAction { |
|
16 |
| |
|
17 |
| private final TestSuite testSuite; |
|
18 |
| |
|
19 |
10
| public AddToTestSuiteAction(TestSuite testSuite) {
|
|
20 |
10
| super();
|
|
21 |
10
| this.testSuite = testSuite;
|
|
22 |
| } |
|
23 |
| |
|
24 |
298
| public void matched(Object matchedObject) {
|
|
25 |
298
| if (Test.class.isAssignableFrom((Class)matchedObject)) {
|
|
26 |
297
| testSuite.addTestSuite((Class)matchedObject);
|
|
27 |
| } |
|
28 |
| else { |
|
29 |
1
| throw new UnsupportedTestClassException("The matched object <"+matchedObject+"> is not a Test!");
|
|
30 |
| } |
|
31 |
| } |
|
32 |
| |
|
33 |
| } |