Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: bac3753aec0150daffbf411fc5bdcf96da857655 (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
63
64
65
66
67
68
69
70
71
72
/*******************************************************************************
 * Copyright (c) 2000, 2011 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;

import org.eclipse.jdt.core.tests.junit.extension.TestCase;

import junit.framework.Test;
import junit.framework.TestSuite;

/**
 * Run all compiler regression tests
 */
public class RunComparableTests extends junit.framework.TestCase {

	public static ArrayList ALL_CLASSES = null;
	static {
		ALL_CLASSES = new ArrayList();
		ALL_CLASSES.add(AmbiguousMethodTest.class);
		ALL_CLASSES.add(AutoBoxingTest.class);
		ALL_CLASSES.add(Compliance_1_5.class);
		ALL_CLASSES.add(GenericTypeTest.class);
		ALL_CLASSES.add(GenericsRegressionTest.class);
		ALL_CLASSES.add(ForeachStatementTest.class);
		ALL_CLASSES.add(StaticImportTest.class);
		ALL_CLASSES.add(VarargsTest.class);
		ALL_CLASSES.add(EnumTest.class);
		ALL_CLASSES.add(MethodVerifyTest.class);
		ALL_CLASSES.add(AnnotationTest.class);
		ALL_CLASSES.add(EnclosingMethodAttributeTest.class);
		// Reset forgotten subsets tests
		TestCase.TESTS_PREFIX = null;
		TestCase.TESTS_NAMES = null;
		TestCase.TESTS_NUMBERS= null;
		TestCase.TESTS_RANGE = null;
		TestCase.RUN_ONLY_ID = null;
	}

	public RunComparableTests(String testName) {
		super(testName);
	}

	public static Test suite() {
		TestSuite ts = new TestSuite(RunComparableTests.class.getName());
		for (int i = 0, size=ALL_CLASSES.size(); i < size; i++) {
			Class testClass = (Class) ALL_CLASSES.get(i);
			try {
				Method suiteMethod = testClass.getDeclaredMethod("suite", new Class[0]); //$NON-NLS-1$
				Test suite = (Test)suiteMethod.invoke(null, new Object[0]);
				ts.addTest(suite);
			} catch (IllegalAccessException e) {
				e.printStackTrace();
			} catch (InvocationTargetException e) {
				e.getTargetException().printStackTrace();
			} catch (NoSuchMethodException e) {
				e.printStackTrace();
			}
		}
		return ts;
	}
}

Back to the top