In this section, you will improve the code of the constructor of junit.framework.TestSuite. To make the intent of the code clearer, you will extract the code that collects test cases from base classes into a new method called collectTestMethods.
Class superClass= theClass;
Vector names= new Vector();
while(Test.class.isAssignableFrom(superClass)) {
Method[] methods= superClass.getDeclaredMethods();
for (int i= 0; i < methods.length; i++) {
addTestMethod(methods[i],names, constructor);
}
superClass= superClass.getSuperclass();
}
Java editor
Refactoring support
Using the Java editor
Refactoring
Refactoring with preview