Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/test/functional/Jsr292/src/com/ibm/j9/jsr292/JSR292TestSuite.java
6007 views
1
/*******************************************************************************
2
* Copyright (c) 2001, 2018 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
package com.ibm.j9.jsr292;
23
24
import java.util.Enumeration;
25
import junit.framework.TestResult;
26
27
/**
28
* @author mesbaha
29
* This class extends the default junit.framework.TestSuite class and redefines the run() method
30
* in order to run only the test cases that are not in a given exclude list for this test suite.
31
*/
32
public class JSR292TestSuite extends junit.framework.TestSuite {
33
34
private String excludeList;
35
36
/**
37
* Default constructor
38
* @param name - Name of the test suite
39
* @param ignoreTestCaseList - A comma separated list of test cases to ignore
40
*/
41
public JSR292TestSuite( String name, String excludeList ) {
42
super( name );
43
this.excludeList = excludeList;
44
}
45
46
/* ( non-Javadoc )
47
* @see junit.framework.TestSuite#run( junit.framework.TestResult )
48
* Overridden version of TestSuite.run() method which invokes the new run( TestSuite, TestResult ) method
49
* in order to ensure we use test filtering.
50
* @param result - This TestResult object to use for result reporting
51
*/
52
public void run( TestResult result ) {
53
run( this, result );
54
}
55
56
/**
57
* This method runs all test cases from this test suite but the ones found in the given ignore list
58
* @param suite - This TestSuite object
59
* @param result - The TestResult object to use
60
*/
61
public void run( junit.framework.TestSuite suite, TestResult result ) {
62
@SuppressWarnings( "rawtypes" )
63
Enumeration en = suite.tests();
64
while ( en.hasMoreElements() ) {
65
junit.framework.Test test = ( junit.framework.Test )en.nextElement();
66
if ( test instanceof junit.framework.TestSuite ) {
67
run( ( junit.framework.TestSuite )test, result );
68
} else {
69
junit.framework.TestCase testCase = ( junit.framework.TestCase )test;
70
//Ignore test cases from the exclude list
71
if ( excludeList == null || excludeList.contains( testCase.getName() ) == false ) {
72
super.runTest( testCase, result );
73
}
74
}
75
}
76
}
77
}
78
79