Skip to main content
summaryrefslogtreecommitdiffstats
blob: 1b2e5c9810db46fcc3f14acdeb1805f43bf8f06c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*******************************************************************************
 * Copyright (c) 2001, 2010 Oracle Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 * 
 * Contributors:
 *     Oracle Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.jsf.test.util;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestResult;
import junit.framework.TestSuite;

import org.eclipse.jst.jsf.test.util.ConfigurableTestCase.TestConfiguration;

public class ConfigurableTestSuite extends TestSuite 
{
    protected TestConfiguration    _configuration;
    
    
    /**
     * Use this constructor when adding to parent ConfigurableTestSuite
     * @param theClass
     * @param name
     */
    public ConfigurableTestSuite(Class<? extends TestCase> theClass, String name) {
        super(theClass, name);
    }

    public ConfigurableTestSuite(Class<?> theClass)
    {
        super(theClass);
    }
    
    public ConfigurableTestSuite(TestConfiguration configuration, String name)
    {
        super(name);
        _configuration = configuration;
    }
    
    public void runTest(Test test, TestResult result) 
    {
        if (test instanceof ConfigurableTestCase)
        {
            ((ConfigurableTestCase)test)
                .setConfiguration(_configuration);
        }
        else if (test instanceof ConfigurableTestSuite)
        {
            ((ConfigurableTestSuite)test)._configuration = 
                  this._configuration;
        }
        super.runTest(test, result);
    }

}

Back to the top