Test (JUnit3IdeaTestRunner runner, String suiteClassName) { String methodName = null; int index = suiteClassName.indexOf(','); if (index != -1) { methodName = suiteClassName.substring(index + 1); suiteClassName = suiteClassName.substring(0, index); } Class<?> testClass = loadTestClass(runner, suiteClassName); if (testClass == null) return null; Test test; if (methodName == null) { try { Method suiteMethod = testClass.getMethod(BaseTestRunner.SUITE_METHODNAME); if (!Modifier.isStatic(suiteMethod.getModifiers())) { String message = MessageFormat.format(ourBundle.getString("junit.suite.must.be.static"), testClass.getName()); System.err.println(message); //runFailed(message); return null; } try { test = (Test)suiteMethod.invoke(null); // static method if (test == null) { return new FailedTestCase(testClass, BaseTestRunner.SUITE_METHODNAME, MessageFormat.format(ourBundle.getString("junit.failed.to.invoke.suite"), "method " + suiteClassName + ".suite() evaluates to null"), null); } test = new SuiteMethodWrapper(test, suiteClassName); } catch (final InvocationTargetException e) { final String message = MessageFormat.format(ourBundle.getString("junit.failed.to.invoke.suite"), testClass + " " + e.getTargetException().toString()); //System.err.println(message); //runner.runFailed(message); runner.clearStatus(); return new FailedTestCase(testClass, BaseTestRunner.SUITE_METHODNAME, message, e); } catch (IllegalAccessException e) { String message = MessageFormat.format(ourBundle.getString("junit.failed.to.invoke.suite"), testClass + " " + e.toString()); //System.err.println(message); //runner.runFailed(message); return new FailedTestCase(testClass, BaseTestRunner.SUITE_METHODNAME, message, e); } } catch (Throwable e) { // try to extract a test suite automatically runner.clearStatus(); test = new TestSuite(testClass); } } else { test = createMethodSuite(runner, testClass, methodName); } return test; }