1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.support.test.internal.runner.junit3;
18
19import junit.framework.Test;
20import junit.framework.TestResult;
21import junit.framework.TestSuite;
22
23import org.junit.Ignore;
24
25import java.util.Enumeration;
26
27/**
28 * A {@link TestSuite} that delegates all calls to another {@link TestSuite}.
29 */
30@Ignore
31class DelegatingTestSuite extends TestSuite {
32
33    private TestSuite mWrappedSuite;
34
35    public DelegatingTestSuite(TestSuite suiteDelegate) {
36        super();
37        mWrappedSuite = suiteDelegate;
38    }
39
40    /**
41     * Return the suite to delegate to
42     */
43    public TestSuite getDelegateSuite() {
44        return mWrappedSuite;
45    }
46
47    /**
48     * Replace the suite to delegate to
49     *
50     * @param newSuiteDelegate
51     */
52    public void setDelegateSuite(TestSuite newSuiteDelegate) {
53        mWrappedSuite = newSuiteDelegate;
54    }
55
56    @Override
57    public void addTest(Test test) {
58        mWrappedSuite.addTest(test);
59    }
60
61    @Override
62    public int countTestCases() {
63        return mWrappedSuite.countTestCases();
64    }
65
66    @Override
67    public String getName() {
68        return mWrappedSuite.getName();
69    }
70
71    @Override
72    public void runTest(Test test, TestResult result) {
73        mWrappedSuite.runTest(test, result);
74    }
75
76    @Override
77    public void setName(String name) {
78        mWrappedSuite.setName(name);
79    }
80
81    @Override
82    public Test testAt(int index) {
83        return mWrappedSuite.testAt(index);
84    }
85
86    @Override
87    public int testCount() {
88        return mWrappedSuite.testCount();
89    }
90
91    @Override
92    public Enumeration<Test> tests() {
93        return mWrappedSuite.tests();
94    }
95
96    @Override
97    public String toString() {
98        return mWrappedSuite.toString();
99    }
100
101    @Override
102    public void run(TestResult result) {
103        mWrappedSuite.run(result);
104    }
105}
106