?? basetestrunner.java
字號:
package junit.textui;
import junit.framework.*;
import java.lang.reflect.*;
import java.text.NumberFormat;
import java.io.*;
import java.util.*;
/**
* Base class for all test runners.
* This class was born live on stage in Sardinia during XP2000.
*/
public abstract class BaseTestRunner{
public static final String SUITE_METHODNAME= "suite";
/**
* Returns the Test corresponding to the given suite. This is
* a template method, subclasses override runFailed(), clearStatus().
*/
public Test getTest(String suiteClassName) {
if (suiteClassName.length() <= 0) {
return null;
}
Class testClass= null;
try {
testClass= Class.forName(suiteClassName);
} catch(Exception e) {
return null;
}
Method suiteMethod= null;
try {
suiteMethod= testClass.getMethod(SUITE_METHODNAME, new Class[0]);
} catch(Exception e) {
// try to extract a test suite automatically
return new TestSuite(testClass);
}
Test test= null;
try {
test= (Test)suiteMethod.invoke(null, new Class[0]); // static method
}
catch (Exception e) {
e.printStackTrace();
return null;
}
return test;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -