如果您不使用 TestCase,则可以将转换删除到 TestCase。
在 JUnit 4.10 TestSuite.createTest(Class theClass, String name) 将采用任何类。
如果我在 4.10 中查看 TestSuite 的源代码
https://github.com/KentBeck/junit/blob/master/src/main/java/junit/framework/TestSuite.java
public class TestSuite implements Test {
/**
 * ...as the moon sets over the early morning Merlin, Oregon
 * mountains, our intrepid adventurers type...
 */
static public Test createTest(Class<?> theClass, String name) {
    Constructor<?> constructor;
    try {
        constructor= getTestConstructor(theClass);
    } catch (NoSuchMethodException e) {
        return warning("Class "+theClass.getName()+" has no public constructor TestCase(String name) or TestCase()");
    }
    Object test;
    try {
        if (constructor.getParameterTypes().length == 0) {
            test= constructor.newInstance(new Object[0]);
            if (test instanceof TestCase)
                ((TestCase) test).setName(name);
        } else {
            test= constructor.newInstance(new Object[]{name});
        }
在这个版本中,它将采用任何类型。