A class can do whatever you want it to do. If that's what you want your TestDrive class to do, then so be it. When it comes to testing classes, I've come to learn that it works just as well to create a main method in the class itself, and test it in the same class, because then you can test your private methods along with the public ones. If testing in another class is what you want, then go for it. What you're doing here, creating a test class for every other class you make (did I get that right?) is sort of needless. It works just fine if you create a single class you can use for testing other classes. Something like this works great.
package testing;
// import JOptionPane, BigInteger, ArrayList, Scanner, Math, and any classes you are testing
public class testing {
public static void main(String[] args) {
long start = System.currentTimeMillis();
/**
*Code to test goes here
**/
long end = System.currentTimeMillis();
System.out.println("Elapsed time: " + (end-start) + " ms."); //prints the amount of time the program takes to complete is milliseconds, useful for algorithm designing.
}
}
That is just a generic testing class that you can use to test most things.